<sys/cdefs.h>: Inhibit macro expansion for __glibc_has_include

Message ID 87a7em6ben.fsf@oldenburg2.str.redhat.com
State New
Headers show
Series
  • <sys/cdefs.h>: Inhibit macro expansion for __glibc_has_include
Related show

Commit Message

Florian Weimer June 12, 2019, 4:01 p.m.
This is currently ineffective with GCC because of GC PR 80005, but
it makes sense to anticipate a fix for this defect.

Suggested by Zack Weinberg.

2019-06-12  Florian Weimer  <fweimer@redhat.com>

	* misc/sys/cdefs.h (__glibc_has_include): Do not use a
	function-like macro, so that __has_include can inhibit expansion
	of its argument.

Comments

Florian Weimer June 14, 2019, 2:09 p.m. | #1
* Florian Weimer:

> This is currently ineffective with GCC because of GC PR 80005, but

> it makes sense to anticipate a fix for this defect.

>

> Suggested by Zack Weinberg.

>

> 2019-06-12  Florian Weimer  <fweimer@redhat.com>

>

> 	* misc/sys/cdefs.h (__glibc_has_include): Do not use a

> 	function-like macro, so that __has_include can inhibit expansion

> 	of its argument.

>

> diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h

> index 638872b87b..ed146ce20b 100644

> --- a/misc/sys/cdefs.h

> +++ b/misc/sys/cdefs.h

> @@ -413,7 +413,7 @@

>  #endif

>  

>  #ifdef __has_include

> -# define __glibc_has_include(header)	__has_include (header)

> +# define __glibc_has_include __has_include

>  #else

>  # define __glibc_has_include(header)	0

>  #endif


This is what I plan to commit shortly.

I don't want to mention the GCC PR in the public header because it will
be outdated soon (I hope).

Thanks,
Florian

<sys/cdefs.h>: Inhibit macro expansion for __glibc_has_include

This is currently ineffective with GCC because of GCC PR 80005, but
it makes sense to anticipate a fix for this defect.

Suggested by Zack Weinberg.

2019-06-14  Florian Weimer  <fweimer@redhat.com>

	* misc/sys/cdefs.h (__glibc_has_include): Do not use a
	function-like macro, so that __has_include can inhibit expansion
	of its argument.

diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h
index 638872b87b..f1bd994a10 100644
--- a/misc/sys/cdefs.h
+++ b/misc/sys/cdefs.h
@@ -413,7 +413,9 @@
 #endif
 
 #ifdef __has_include
-# define __glibc_has_include(header)	__has_include (header)
+/* Do not use a function-like macro, so that __has_include can inhibit
+   macro expansion.  */
+# define __glibc_has_include __has_include
 #else
 # define __glibc_has_include(header)	0
 #endif
Carlos O'Donell June 14, 2019, 2:18 p.m. | #2
On 6/14/19 10:09 AM, Florian Weimer wrote:
> * Florian Weimer:

> 

>> This is currently ineffective with GCC because of GC PR 80005, but

>> it makes sense to anticipate a fix for this defect.

>>

>> Suggested by Zack Weinberg.

>>

>> 2019-06-12  Florian Weimer  <fweimer@redhat.com>

>>

>> 	* misc/sys/cdefs.h (__glibc_has_include): Do not use a

>> 	function-like macro, so that __has_include can inhibit expansion

>> 	of its argument.

>>

>> diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h

>> index 638872b87b..ed146ce20b 100644

>> --- a/misc/sys/cdefs.h

>> +++ b/misc/sys/cdefs.h

>> @@ -413,7 +413,7 @@

>>  #endif

>>  

>>  #ifdef __has_include

>> -# define __glibc_has_include(header)	__has_include (header)

>> +# define __glibc_has_include __has_include

>>  #else

>>  # define __glibc_has_include(header)	0

>>  #endif

> 

> This is what I plan to commit shortly.

> 

> I don't want to mention the GCC PR in the public header because it will

> be outdated soon (I hope).

> 

> Thanks,

> Florian

> 

> <sys/cdefs.h>: Inhibit macro expansion for __glibc_has_include

> 

> This is currently ineffective with GCC because of GCC PR 80005, but

> it makes sense to anticipate a fix for this defect.

> 

> Suggested by Zack Weinberg.

> 

> 2019-06-14  Florian Weimer  <fweimer@redhat.com>

> 

> 	* misc/sys/cdefs.h (__glibc_has_include): Do not use a

> 	function-like macro, so that __has_include can inhibit expansion

> 	of its argument.

> 


LGTM.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>



> diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h

> index 638872b87b..f1bd994a10 100644

> --- a/misc/sys/cdefs.h

> +++ b/misc/sys/cdefs.h

> @@ -413,7 +413,9 @@

>  #endif

>  

>  #ifdef __has_include

> -# define __glibc_has_include(header)	__has_include (header)

> +/* Do not use a function-like macro, so that __has_include can inhibit

> +   macro expansion.  */

> +# define __glibc_has_include __has_include

>  #else

>  # define __glibc_has_include(header)	0

>  #endif

> 



-- 
Cheers,
Carlos.

Patch

diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h
index 638872b87b..ed146ce20b 100644
--- a/misc/sys/cdefs.h
+++ b/misc/sys/cdefs.h
@@ -413,7 +413,7 @@ 
 #endif
 
 #ifdef __has_include
-# define __glibc_has_include(header)	__has_include (header)
+# define __glibc_has_include __has_include
 #else
 # define __glibc_has_include(header)	0
 #endif