[llvm] r306002 - [Solaris] replace Solaris.h hack with a set of better hacks

via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 22 12:55:04 PDT 2017


Here’s a patch. Does it look fine to you?

diff --git a/include/llvm/module.modulemap b/include/llvm/module.modulemap
index 2557f5fa970..dd419e86131 100644
--- a/include/llvm/module.modulemap
+++ b/include/llvm/module.modulemap
@@ -275,8 +275,9 @@ module LLVM_Utils {
     umbrella "Support"
     module * { export * }
 
-    // Exclude this; it's fundamentally non-modular.
+    // Exclude these; they are fundamentally non-modular.
     exclude header "Support/PluginLoader.h"
+    exclude header "Support/Solaris/sys/regset.h"
 
     // These are intended for textual inclusion.
     textual header "Support/ARMTargetParser.def”

vedant

> On Jun 22, 2017, at 12:51 PM, vsk at apple.com wrote:
> 
> Hi Kamil,
> 
> I think this commit breaks the modules build.
> 
> I’m getting:
> 
> FAILED: lib/Support/CMakeFiles/LLVMSupport.dir/ARMBuildAttrs.cpp.o 
> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++   -DGTEST_HAS_RTTI=0 -DLLVM_BUILD_GLOBAL_ISEL -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Ilib/Support -I/Users/vk/src/llvm.org <http://llvm.org/>-master/llvm/lib/Support -Iinclude -I/Users/vk/src/llvm.org <http://llvm.org/>-master/llvm/include -fPIC -fvisibility-inlines-hidden -Werror=date-time -std=c++11 -fmodules -fmodules-cache-path=/Volumes/Builds/llvm.org <http://llvm.org/>-master-R/module.cache -fcxx-modules -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wcovered-switch-default -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wstring-conversion -fcolor-diagnostics -O3 -DNDEBUG -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk    -fno-exceptions -fno-rtti -MD -MT lib/Support/CMakeFiles/LLVMSupport.dir/ARMBuildAttrs.cpp.o -MF lib/Support/CMakeFiles/LLVMSupport.dir/ARMBuildAttrs.cpp.o.d -o lib/Support/CMakeFiles/LLVMSupport.dir/ARMBuildAttrs.cpp.o -c /Users/vk/src/llvm.org <http://llvm.org/>-master/llvm/lib/Support/ARMBuildAttrs.cpp
> While building module 'LLVM_Utils' imported from /Users/vk/src/llvm.org <http://llvm.org/>-master/llvm/lib/Support/ARMBuildAttrs.cpp:10:
> In file included from <module-includes>:176:
> /Users/vk/src/llvm.org <http://llvm.org/>-master/llvm/include/llvm/Support/Solaris/sys/regset.h:17:2: warning: #include_next is a language extension [-Wgnu-include-next]
> #include_next <sys/regset.h>
>  ^
> /Users/vk/src/llvm.org <http://llvm.org/>-master/llvm/include/llvm/Support/Solaris/sys/regset.h:17:15: fatal error: 'sys/regset.h' file not found
> #include_next <sys/regset.h>
>               ^~~~~~~~~~~~~~
> /Users/vk/src/llvm.org <http://llvm.org/>-master/llvm/lib/Support/ARMBuildAttrs.cpp:10:10: fatal error: could not build module 'LLVM_Utils'
> #include "llvm/ADT/StringRef.h"
>  ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
> 1 warning and 2 errors generated.
> 
> Reproducer:
> 
> $ cmake -G Ninja \
>     -DLLVM_TARGETS_TO_BUILD="X86;ARM;AArch64" \
>     -DCMAKE_BUILD_TYPE:STRING=Release \
>     -DLLVM_ENABLE_ASSERTIONS:BOOL=Off \
>     -DLLVM_INCLUDE_TESTS:BOOL=On \
>     -DLLVM_ENABLE_MODULES=On \
>     ~/src/llvm.org <http://llvm.org/>-master/llvm
> 
> vedant
> 
>> On Jun 22, 2017, at 6:18 AM, Kamil Rytarowski via llvm-commits <llvm-commits at lists.llvm.org <mailto:llvm-commits at lists.llvm.org>> wrote:
>> 
>> Author: kamil
>> Date: Thu Jun 22 08:18:46 2017
>> New Revision: 306002
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=306002&view=rev <http://llvm.org/viewvc/llvm-project?rev=306002&view=rev>
>> Log:
>> [Solaris] replace Solaris.h hack with a set of better hacks
>> 
>> Summary:
>> Got rid of unwieldy -include Solaris.h portability solution, replacing it with interposed header and moving endian defines into Host.h.
>> 
>> Fixes PR28370.
>> 
>> Reviewers: joerg, alekseyshl, mgorny
>> 
>> Reviewed By: joerg
>> 
>> Subscribers: llvm-commits, mgorny, ro, krytarowski
>> 
>> Patch by Fedor Sergeev.
>> 
>> Differential Revision: https://reviews.llvm.org/D3413 <https://reviews.llvm.org/D3413>
>> 
>> Added:
>>    llvm/trunk/include/llvm/Support/Solaris/
>>    llvm/trunk/include/llvm/Support/Solaris/sys/
>>    llvm/trunk/include/llvm/Support/Solaris/sys/regset.h
>>      - copied, changed from r306001, llvm/trunk/include/llvm/Support/Solaris.h
>> Removed:
>>    llvm/trunk/include/llvm/Support/Solaris.h
>> Modified:
>>    llvm/trunk/CMakeLists.txt
>>    llvm/trunk/include/llvm/Support/Host.h
>>    llvm/trunk/include/llvm/module.modulemap
>> 
>> Modified: llvm/trunk/CMakeLists.txt
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/CMakeLists.txt?rev=306002&r1=306001&r2=306002&view=diff <http://llvm.org/viewvc/llvm-project/llvm/trunk/CMakeLists.txt?rev=306002&r1=306001&r2=306002&view=diff>
>> ==============================================================================
>> --- llvm/trunk/CMakeLists.txt (original)
>> +++ llvm/trunk/CMakeLists.txt Thu Jun 22 08:18:46 2017
>> @@ -804,7 +804,8 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "(FreeBS
>> endif(${CMAKE_SYSTEM_NAME} MATCHES "(FreeBSD|DragonFly)")
>> 
>> if( ${CMAKE_SYSTEM_NAME} MATCHES SunOS )
>> -   SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -include llvm/Support/Solaris.h")
>> +   # special hack for Solaris to handle crazy system sys/regset.h
>> +   include_directories("${LLVM_MAIN_INCLUDE_DIR}/llvm/Support/Solaris")
>> endif( ${CMAKE_SYSTEM_NAME} MATCHES SunOS )
>> 
>> # Make sure we don't get -rdynamic in every binary. For those that need it,
>> 
>> Modified: llvm/trunk/include/llvm/Support/Host.h
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Host.h?rev=306002&r1=306001&r2=306002&view=diff <http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Host.h?rev=306002&r1=306001&r2=306002&view=diff>
>> ==============================================================================
>> --- llvm/trunk/include/llvm/Support/Host.h (original)
>> +++ llvm/trunk/include/llvm/Support/Host.h Thu Jun 22 08:18:46 2017
>> @@ -21,6 +21,16 @@
>> #include <endian.h>
>> #elif defined(_AIX)
>> #include <sys/machine.h>
>> +#elif defined(__sun)
>> +/* Solaris provides _BIG_ENDIAN/_LITTLE_ENDIAN selector in sys/types.h */
>> +#include <sys/types.h>
>> +#define BIG_ENDIAN 4321
>> +#define LITTLE_ENDIAN 1234
>> +#if defined(_BIG_ENDIAN)
>> +#define BYTE_ORDER BIG_ENDIAN
>> +#else
>> +#define BYTE_ORDER LITTLE_ENDIAN
>> +#endif
>> #else
>> #if !defined(BYTE_ORDER) && !defined(LLVM_ON_WIN32)
>> #include <machine/endian.h>
>> 
>> Removed: llvm/trunk/include/llvm/Support/Solaris.h
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Solaris.h?rev=306001&view=auto <http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Solaris.h?rev=306001&view=auto>
>> ==============================================================================
>> --- llvm/trunk/include/llvm/Support/Solaris.h (original)
>> +++ llvm/trunk/include/llvm/Support/Solaris.h (removed)
>> @@ -1,49 +0,0 @@
>> -/*===- llvm/Support/Solaris.h ------------------------------------*- C++ -*-===*
>> - *
>> - *                     The LLVM Compiler Infrastructure
>> - *
>> - * This file is distributed under the University of Illinois Open Source
>> - * License. See LICENSE.TXT for details.
>> - *
>> - *===----------------------------------------------------------------------===*
>> - *
>> - * This file contains portability fixes for Solaris hosts.
>> - *
>> - *===----------------------------------------------------------------------===*/
>> -
>> -#ifndef LLVM_SUPPORT_SOLARIS_H
>> -#define LLVM_SUPPORT_SOLARIS_H
>> -
>> -#include <sys/regset.h>
>> -#include <sys/types.h>
>> -
>> -/* Solaris doesn't have endian.h. SPARC is the only supported big-endian ISA. */
>> -#define BIG_ENDIAN 4321
>> -#define LITTLE_ENDIAN 1234
>> -#if defined(__sparc) || defined(__sparc__)
>> -#define BYTE_ORDER BIG_ENDIAN
>> -#else
>> -#define BYTE_ORDER LITTLE_ENDIAN
>> -#endif
>> -
>> -#undef CS
>> -#undef DS
>> -#undef ES
>> -#undef FS
>> -#undef GS
>> -#undef SS
>> -#undef EAX
>> -#undef ECX
>> -#undef EDX
>> -#undef EBX
>> -#undef ESP
>> -#undef EBP
>> -#undef ESI
>> -#undef EDI
>> -#undef EIP
>> -#undef UESP
>> -#undef EFL
>> -#undef ERR
>> -#undef TRAPNO
>> -
>> -#endif
>> 
>> Copied: llvm/trunk/include/llvm/Support/Solaris/sys/regset.h (from r306001, llvm/trunk/include/llvm/Support/Solaris.h)
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Solaris/sys/regset.h?p2=llvm/trunk/include/llvm/Support/Solaris/sys/regset.h&p1=llvm/trunk/include/llvm/Support/Solaris.h&r1=306001&r2=306002&rev=306002&view=diff <http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Solaris/sys/regset.h?p2=llvm/trunk/include/llvm/Support/Solaris/sys/regset.h&p1=llvm/trunk/include/llvm/Support/Solaris.h&r1=306001&r2=306002&rev=306002&view=diff>
>> ==============================================================================
>> --- llvm/trunk/include/llvm/Support/Solaris.h (original)
>> +++ llvm/trunk/include/llvm/Support/Solaris/sys/regset.h Thu Jun 22 08:18:46 2017
>> @@ -1,4 +1,4 @@
>> -/*===- llvm/Support/Solaris.h ------------------------------------*- C++ -*-===*
>> +/*===- llvm/Support/Solaris/sys/regset.h ------------------------*- C++ -*-===*
>>  *
>>  *                     The LLVM Compiler Infrastructure
>>  *
>> @@ -7,24 +7,14 @@
>>  *
>>  *===----------------------------------------------------------------------===*
>>  *
>> - * This file contains portability fixes for Solaris hosts.
>> + * This file works around excessive name space pollution from the system header
>> + * on Solaris hosts.
>>  *
>>  *===----------------------------------------------------------------------===*/
>> 
>> -#ifndef LLVM_SUPPORT_SOLARIS_H
>> -#define LLVM_SUPPORT_SOLARIS_H
>> +#ifndef LLVM_SUPPORT_SOLARIS_SYS_REGSET_H
>> 
>> -#include <sys/regset.h>
>> -#include <sys/types.h>
>> -
>> -/* Solaris doesn't have endian.h. SPARC is the only supported big-endian ISA. */
>> -#define BIG_ENDIAN 4321
>> -#define LITTLE_ENDIAN 1234
>> -#if defined(__sparc) || defined(__sparc__)
>> -#define BYTE_ORDER BIG_ENDIAN
>> -#else
>> -#define BYTE_ORDER LITTLE_ENDIAN
>> -#endif
>> +#include_next <sys/regset.h>
>> 
>> #undef CS
>> #undef DS
>> 
>> Modified: llvm/trunk/include/llvm/module.modulemap
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/module.modulemap?rev=306002&r1=306001&r2=306002&view=diff <http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/module.modulemap?rev=306002&r1=306001&r2=306002&view=diff>
>> ==============================================================================
>> --- llvm/trunk/include/llvm/module.modulemap (original)
>> +++ llvm/trunk/include/llvm/module.modulemap Thu Jun 22 08:18:46 2017
>> @@ -275,9 +275,6 @@ module LLVM_Utils {
>>     umbrella "Support"
>>     module * { export * }
>> 
>> -    // Exclude this; it's only included on Solaris.
>> -    exclude header "Support/Solaris.h"
>> -
>>     // Exclude this; it's fundamentally non-modular.
>>     exclude header "Support/PluginLoader.h"
>> 
>> 
>> 
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at lists.llvm.org <mailto:llvm-commits at lists.llvm.org>
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170622/ec60f801/attachment.html>


More information about the llvm-commits mailing list