Skip to content

linux: update header used for major macro #286

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 2, 2017

Conversation

compnerd
Copy link
Member

Newer versions of glibc indicate that they intend to move the major
macro from sys/types.h to sys/sysmacros.h. Add a check for the
header and include that earlier to ensure that the macro is provided by
the newer header when available/possible. This avoids an unnecessary
warning from the system headers.

@compnerd
Copy link
Member Author

CC: @das @dgrove-oss

@compnerd
Copy link
Member Author

compnerd commented Aug 1, 2017

Since I put this up on a weekend, a gentle ping during the work week!

os/linux_base.h Outdated
#if __has_include(<config/config_ac.h>)
#include <config/config_ac.h>
#else
#include <config/config.h>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW the reason for the name change of the autotools-generate header was to avoid overwriting the manually maintained config/config.h header for Darwin (and getting it to show up as changed in git etc).

it looks like the same thing was replicated with the CMake build system, so only #include <config/config_ac.h> should be needed here ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WFM, I'll adjust that.

Newer versions of glibc indicate that they intend to move the `major`
macro from `sys/types.h` to `sys/sysmacros.h`.  Add a check for the
header and include that earlier to ensure that the macro is provided by
the newer header when available/possible.  This avoids an unnecessary
warning from the system headers.
@atrick
Copy link
Contributor

atrick commented Aug 2, 2017

swift-corelibs-libdispatch/os/linux_base.h:16:10: fatal error: 'config/config_ac.h' file not found
#include <config/config_ac.h>
^

@das
Copy link
Contributor

das commented Aug 2, 2017

huh, we have
AC_CONFIG_HEADER([config/config_ac.h])
in configure.ac to generate that header (we really don't want config/config.h to be used on Linux since that is the static Darwin config).

Or Is the issue that that header is not getting installed ?
we can't use it from os/linux_base.h in that case (at least not from that path, it could be installed into os/ alongside linux_base.h, probably with a different name like linux_config.h)

@atrick do you have a full build log ? was the above issue when building a dependent project or when building libdispatch itself ?

@das
Copy link
Contributor

das commented Aug 2, 2017

looks like it is the latter, from 3138:

[554/850] Building CXX object tools/SourceKit/lib/Support/CMakeFiles/SourceKitSupport.dir/Concurrency-libdispatch.cpp.o
FAILED: tools/SourceKit/lib/Support/CMakeFiles/SourceKitSupport.dir/Concurrency-libdispatch.cpp.o 
/usr/bin/clang++   -DCMARK_STATIC_DEFINE -DGTEST_HAS_RTTI=0 -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Itools/SourceKit/lib/Support -I/home/buildnode/disk2/workspace/oss-swift-incremental-RA-linux-ubuntu-14_04/swift/tools/SourceKit/lib/Support -I/home/buildnode/disk2/workspace/oss-swift-incremental-RA-linux-ubuntu-14_04/swift/tools/SourceKit/include -Iinclude -I/home/buildnode/disk2/workspace/oss-swift-incremental-RA-linux-ubuntu-14_04/swift/include -I/home/buildnode/disk2/workspace/oss-swift-incremental-RA-linux-ubuntu-14_04/llvm/include -I/home/buildnode/disk2/workspace/oss-swift-incremental-RA-linux-ubuntu-14_04/buildbot_incremental/llvm-linux-x86_64/include -I/home/buildnode/disk2/workspace/oss-swift-incremental-RA-linux-ubuntu-14_04/buildbot_incremental/llvm-linux-x86_64/tools/clang/include -I/home/buildnode/disk2/workspace/oss-swift-incremental-RA-linux-ubuntu-14_04/llvm/tools/clang/include -I/home/buildnode/disk2/workspace/oss-swift-incremental-RA-linux-ubuntu-14_04/cmark/src -I/home/buildnode/disk2/workspace/oss-swift-incremental-RA-linux-ubuntu-14_04/buildbot_incremental/cmark-linux-x86_64/src -I/home/buildnode/disk2/workspace/oss-swift-incremental-RA-linux-ubuntu-14_04/swift-corelibs-libdispatch -Wno-unknown-warning-option -Werror=unguarded-availability-new -fno-stack-protector -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wcovered-switch-default -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wstring-conversion -Werror=date-time -std=c++11 -fcolor-diagnostics -ffunction-sections -fdata-sections -Werror=switch -Wdocumentation -Wimplicit-fallthrough -Wunreachable-code -Woverloaded-virtual -DOBJC_OLD_DISPATCH_PROTOTYPES=0 -O3    -UNDEBUG  -fno-exceptions -fno-rtti -target x86_64-unknown-linux-gnu -O2 -g0 -UNDEBUG -fblocks -MMD -MT tools/SourceKit/lib/Support/CMakeFiles/SourceKitSupport.dir/Concurrency-libdispatch.cpp.o -MF tools/SourceKit/lib/Support/CMakeFiles/SourceKitSupport.dir/Concurrency-libdispatch.cpp.o.d -o tools/SourceKit/lib/Support/CMakeFiles/SourceKitSupport.dir/Concurrency-libdispatch.cpp.o -c /home/buildnode/disk2/workspace/oss-swift-incremental-RA-linux-ubuntu-14_04/swift/tools/SourceKit/lib/Support/Concurrency-libdispatch.cpp
In file included from /home/buildnode/disk2/workspace/oss-swift-incremental-RA-linux-ubuntu-14_04/swift/tools/SourceKit/lib/Support/Concurrency-libdispatch.cpp:19:
In file included from /home/buildnode/disk2/workspace/oss-swift-incremental-RA-linux-ubuntu-14_04/swift-corelibs-libdispatch/dispatch/dispatch.h:30:
/home/buildnode/disk2/workspace/oss-swift-incremental-RA-linux-ubuntu-14_04/swift-corelibs-libdispatch/os/linux_base.h:16:10: fatal error: 'config/config_ac.h' file not found
#include <config/config_ac.h>
         ^

probably the simplest option is to just wrap this new header include in __has_include(<sys/sysmacros.h>)
instead of a configure-generated define

@das
Copy link
Contributor

das commented Aug 2, 2017

the existing HAVE_SYS_CDEFS_H case almost certainly has the same issue and should be fixed the same way

@compnerd compnerd deleted the major-update branch August 2, 2017 17:09
@compnerd
Copy link
Member Author

compnerd commented Aug 2, 2017

Okay, Ill create a new PR to change it over.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants