This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


* Emilio Cobos Álvarez:

> This causes issues when using clang with -frewrite-includes to e.g., submit the
> translation unit to a distributed compiler.

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.

I've tried to push this into Gerrit, but we can't Cc: people who do not
have accounts in the tool.  Not your fault.  We can continue on the
mailing list.

> 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

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>

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.

> diff --git a/sysdeps/unix/sysv/linux/bits/statx.h b/sysdeps/unix/sysv/linux/bits/statx.h
> index ff3f2e8973..14d5992226 100644
> --- a/sysdeps/unix/sysv/linux/bits/statx.h
> +++ b/sysdeps/unix/sysv/linux/bits/statx.h
> @@ -26,12 +26,14 @@
>  
>  /* 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
> +#  if __has_include("linux/stat.h")
> +#   include "linux/stat.h"
> +#   ifdef STATX_TYPE
> +#    define __statx_timestamp_defined 1
> +#    define __statx_defined 1
> +#   endif
> +#  endif
>  #endif

The indentation is slight off here, I think.  Each nested conditional
adds one space after the #.  Please also include a space after
__has_include.

Thanks,
Florian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]