[review] libc: Don't use a custom wrapper macro around __has_include.

Florian Weimer (Code Review) gerrit@gnutoolchain-gerrit.osci.io
Thu Nov 21 13:00:00 GMT 2019


Florian Weimer has posted comments on this change.

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/glibc/+/697
......................................................................


Patch Set 1:

(4 comments)

Thanks for the patch.  The substance of the patch is okay.  I would prefer if you could repost it with the minor issues mentioned below addressed, then I can push it on your behalf.

| --- /dev/null
| +++ /COMMIT_MSG
| @@ -1,0 +8,17 @@ libc: Don't use a custom wrapper macro around __has_include.
| +
| +This causes issues when using clang with -frewrite-includes to e.g., submit the
| +translation unit to a distributed compiler.
| +
| +In my case, I was building Firefox using sccache.
| +
| +See https://bugs.llvm.org/show_bug.cgi?id=43982 for a reduced test-case since I
| +initially thought this was a clang bug.
| +
| +Apparently doing this is invalid C++ per:
| +
| + * http://eel.is/c++draft/cpp.cond#7.sentence-2

PS1, Line 19:

I think it's probably better to quote the actual language in the
standard.

| +
| +(See https://bugs.llvm.org/show_bug.cgi?id=37990)
| +
| +Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>

PS1, Line 23:

We do not use Signed-off-by, but copyright assignments, but we have
been advised that this is not necessary for changes of this size.

| +Change-Id: Id4b8ee19176a9e4624b533087ba870c418f27e60
| --- sysdeps/unix/sysv/linux/bits/statx.h
| +++ sysdeps/unix/sysv/linux/bits/statx.h
| @@ -26,12 +26,14 @@ /* Use the Linux kernel header if available.  */
|  
|  /* Use "" to work around incorrect macro expansion of the
|     __has_include argument (GCC PR 80005).  */
| -#if __glibc_has_include ("linux/stat.h")
| -# include "linux/stat.h"
| -# ifdef STATX_TYPE
| -#  define __statx_timestamp_defined 1
| -#  define __statx_defined 1
| -# endif
| +#ifdef __has_include

PS1, Line 29:

I think the indentation is slightly off here. Each nested conditional
should add one space after the #.

| +#  if __has_include("linux/stat.h")

PS1, Line 30:

Please include a space after __has_include.

| +#   include "linux/stat.h"
| +#   ifdef STATX_TYPE
| +#    define __statx_timestamp_defined 1
| +#    define __statx_defined 1
| +#   endif
| +#  endif
|  #endif
|  
|  #include <bits/statx-generic.h>

-- 
Gerrit-Project: glibc
Gerrit-Branch: master
Gerrit-Change-Id: Id4b8ee19176a9e4624b533087ba870c418f27e60
Gerrit-Change-Number: 697
Gerrit-PatchSet: 1
Gerrit-Owner: Florian Weimer <fweimer@redhat.com>
Gerrit-Reviewer: Florian Weimer <fweimer@redhat.com>
Gerrit-Comment-Date: Thu, 21 Nov 2019 13:00:27 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment



More information about the Libc-alpha mailing list