Skip to content

Commit

Permalink
Merge pull request #140 from marsupial/pause
Browse files Browse the repository at this point in the history
Fixes for building with clang.
  • Loading branch information
pixar-oss committed Jan 28, 2017
2 parents adcc58f + 37911d7 commit 88f609f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
8 changes: 7 additions & 1 deletion cmake/defaults/gccclangshareddefaults.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,13 @@ _disable_warning("deprecated")
_disable_warning("deprecated-declarations")

# Suppress unused typedef warnings emanating from boost.
_disable_warning("unused-local-typedefs")
if (NOT CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR
NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.6)
if (NOT CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" OR
NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.1)
_disable_warning("unused-local-typedefs")
endif()
endif()

if (${PXR_MAYA_TBB_BUG_WORKAROUND})
set(_PXR_GCC_CLANG_SHARED_CXX_FLAGS "${_PXR_GCC_CLANG_SHARED_CXX_FLAGS} -Wl,-Bsymbolic")
Expand Down
2 changes: 1 addition & 1 deletion pxr/base/lib/arch/attributes.h
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ PXR_NAMESPACE_OPEN_SCOPE
Arch_ConstructorInit _arch_constructor_init;
}

#elif defined(ARCH_COMPILER_GCC)
#elif defined(ARCH_COMPILER_GCC) || defined(ARCH_COMPILER_CLANG)

// The used attribute is required to prevent these apparently unused
// functions from being removed by the linker.
Expand Down
3 changes: 2 additions & 1 deletion pxr/base/lib/arch/nap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ ArchThreadYield()
void
ArchThreadPause()
{
#if defined (ARCH_CPU_INTEL) && defined(ARCH_COMPILER_GCC)
#if defined (ARCH_CPU_INTEL) && (defined(ARCH_COMPILER_GCC) || \
defined(ARCH_COMPILER_CLANG))
__asm__ __volatile__ ("pause");
#elif defined(ARCH_OS_WINDOWS)
YieldProcessor();
Expand Down
5 changes: 3 additions & 2 deletions pxr/base/lib/tf/testenv/SIGFPE.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ main(int argc, char **argv)
// as we leave them off by default.
TfInstallTerminateAndCrashHandlers();

int a = 1;
int b = 0;
// Avoid compiler doing the constant math expression
volatile int a = 1;
volatile int b = 0;
int c = a/b;
printf("%d",c);
}
Expand Down

0 comments on commit 88f609f

Please sign in to comment.