bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
* improve clang support (34)
@ 2020-08-16 16:55 Bruno Haible
  2020-08-16 20:08 ` Paul Smith
  0 siblings, 1 reply; 4+ messages in thread
From: Bruno Haible @ 2020-08-16 16:55 UTC (permalink / raw
  To: bug-gnulib

clang has #include_next.


2020-08-16  Bruno Haible  <bruno@clisp.org>

	absolute-header: Add support for clang.
	* modules/absolute-header (Makefile.am): Include '__clang__' in the
	HAVE_INCLUDE_NEXT expression.

diff --git a/modules/absolute-header b/modules/absolute-header
index 491d3d2..1866348 100644
--- a/modules/absolute-header
+++ b/modules/absolute-header
@@ -12,7 +12,7 @@ Makefile.am:
 # Use this preprocessor expression to decide whether #include_next works.
 # Do not rely on a 'configure'-time test for this, since the expression
 # might appear in an installed header, which is used by some other compiler.
-HAVE_INCLUDE_NEXT = (__GNUC__ || 60000000 <= __DECC_VER)
+HAVE_INCLUDE_NEXT = (__GNUC__ || __clang__ || 60000000 <= __DECC_VER)
 
 Include:
 



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: improve clang support (34)
  2020-08-16 16:55 improve clang support (34) Bruno Haible
@ 2020-08-16 20:08 ` Paul Smith
  2020-08-16 20:54   ` Bruno Haible
  0 siblings, 1 reply; 4+ messages in thread
From: Paul Smith @ 2020-08-16 20:08 UTC (permalink / raw
  To: Bruno Haible, bug-gnulib

On Sun, 2020-08-16 at 18:55 +0200, Bruno Haible wrote:
> +HAVE_INCLUDE_NEXT = (__GNUC__ || __clang__ || 60000000 <= __DECC_VER)

Just wondering, are these changes for the sake of documentation, or are
they really needed (do you see problems without them)?

In my experience with clang, it always defines both __clang__ and
__GNUC__ so changes like this don't change behavior.

I definitely have no objection to adding them; I'm curious if there's
something going on here I'm not familiar with.

  $ clang -x c /dev/null -dM -E | grep -i gnu
  #define __GNUC_MINOR__ 2
  #define __GNUC_PATCHLEVEL__ 1
  #define __GNUC_STDC_INLINE__ 1
  #define __GNUC__ 4
  #define __gnu_linux__ 1




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: improve clang support (34)
  2020-08-16 20:08 ` Paul Smith
@ 2020-08-16 20:54   ` Bruno Haible
  2020-08-16 23:06     ` Paul Smith
  0 siblings, 1 reply; 4+ messages in thread
From: Bruno Haible @ 2020-08-16 20:54 UTC (permalink / raw
  To: psmith; +Cc: bug-gnulib

Hi Paul,

Paul Smith wrote:
> > +HAVE_INCLUDE_NEXT = (__GNUC__ || __clang__ || 60000000 <= __DECC_VER)
> 
> Just wondering, are these changes for the sake of documentation, or are
> they really needed (do you see problems without them)?

This Makefile variable HAVE_INCLUDE_NEXT is not used in Gnulib, but some
packages may be using it. I included this module in the clang support for
completeness.

> In my experience with clang, it always defines both __clang__ and
> __GNUC__ so changes like this don't change behavior.

clang for Windows defines __clang__ but does not define __GNUC__. [1]

Bruno

[1] https://lists.gnu.org/archive/html/bug-gnulib/2020-08/msg00038.html



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: improve clang support (34)
  2020-08-16 20:54   ` Bruno Haible
@ 2020-08-16 23:06     ` Paul Smith
  0 siblings, 0 replies; 4+ messages in thread
From: Paul Smith @ 2020-08-16 23:06 UTC (permalink / raw
  To: Bruno Haible; +Cc: bug-gnulib

On Sun, 2020-08-16 at 22:54 +0200, Bruno Haible wrote:
> This Makefile variable HAVE_INCLUDE_NEXT is not used in Gnulib, but
> some packages may be using it. I included this module in the clang
> support for completeness.

Thanks; I wasn't really asking about this particular change per se,
rather the set of changes that have been made that are similar to this.

> > In my experience with clang, it always defines both __clang__ and
> > __GNUC__ so changes like this don't change behavior.
> 
> clang for Windows defines __clang__ but does not define __GNUC__. [1]

Aha!  The clang devs are constantly... "surprising" me with their
choices in these areas.  I learned something so it was worth asking :).

Cheers!



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-08-16 23:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-16 16:55 improve clang support (34) Bruno Haible
2020-08-16 20:08 ` Paul Smith
2020-08-16 20:54   ` Bruno Haible
2020-08-16 23:06     ` Paul Smith

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).