Add new _ISOCxx macros?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Add new _ISOCxx macros?

Christian Jullien-3

Hi all,

 

When we use tcc on Linux, we also use /usr/include/*.h.

Some definitions are only visible for C11 and controlled by use of _ISOC11_SOURCE as used by glibc (see for example http://man7.org/linux/man-pages/man7/feature_test_macros.7.html).

 

As tcc is C99 by default, I propose to also automatically set _ISOC99_SOURCE by default but _ISOC11_SOURCE when -std=c11 is used.

 

Wdyt?

 

Reference:

 

    _ISOC99_SOURCE (since glibc 2.1.3)

               Exposes declarations consistent with the ISO C99 standard.

 

               Earlier glibc 2.1.x versions recognized an equivalent macro

               named _ISOC9X_SOURCE (because the C99 standard had not then

               been finalized).  Although the use of this macro is obsolete,

               glibc continues to recognize it for backward compatibility.

 

               Defining _ISOC99_SOURCE also exposes ISO C (1990) Amendment 1

               ("C95") definitions.  (The primary change in C95 was support

               for international character sets.)

 

               Invoking the C compiler with the option -std=c99 produces the

               same effects as defining this macro.

 

       _ISOC11_SOURCE (since glibc 2.16)

               Exposes declarations consistent with the ISO C11 standard.

               Defining this macro also enables C99 and C95 features (like

               _ISOC99_SOURCE).

 

               Invoking the C compiler with the option -std=c11 produces the

               same effects as defining this macro.


_______________________________________________
Tinycc-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel
ian
Reply | Threaded
Open this post in threaded view
|

Re: Add new _ISOCxx macros?

ian

Hi Christian,

It seems consistent to me.

Regards.

Le 16/01/2020 à 06:55, Christian Jullien a écrit :

Hi all,

 

When we use tcc on Linux, we also use /usr/include/*.h.

Some definitions are only visible for C11 and controlled by use of _ISOC11_SOURCE as used by glibc (see for example http://man7.org/linux/man-pages/man7/feature_test_macros.7.html).

 

As tcc is C99 by default, I propose to also automatically set _ISOC99_SOURCE by default but _ISOC11_SOURCE when -std=c11 is used.

 

Wdyt?

 

Reference:

 

    _ISOC99_SOURCE (since glibc 2.1.3)

               Exposes declarations consistent with the ISO C99 standard.

 

               Earlier glibc 2.1.x versions recognized an equivalent macro

               named _ISOC9X_SOURCE (because the C99 standard had not then

               been finalized).  Although the use of this macro is obsolete,

               glibc continues to recognize it for backward compatibility.

 

               Defining _ISOC99_SOURCE also exposes ISO C (1990) Amendment 1

               ("C95") definitions.  (The primary change in C95 was support

               for international character sets.)

 

               Invoking the C compiler with the option -std=c99 produces the

               same effects as defining this macro.

 

       _ISOC11_SOURCE (since glibc 2.16)

               Exposes declarations consistent with the ISO C11 standard.

               Defining this macro also enables C99 and C95 features (like

               _ISOC99_SOURCE).

 

               Invoking the C compiler with the option -std=c11 produces the

               same effects as defining this macro.


_______________________________________________
Tinycc-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel
--
-- [hidden email]
-- Développeur compulsif

_______________________________________________
Tinycc-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel
Reply | Threaded
Open this post in threaded view
|

Re: Add new _ISOCxx macros?

Christian Jullien-3
In reply to this post by Christian Jullien-3

Pushed on mob.

 

Please note that those macros are defined by gcc only when _GNU_SOURCE is supplied.

With tcc they are unconditionally defined except on Windows (which does not use glibc at all).

 

C.

 

From: Tinycc-devel [mailto:tinycc-devel-bounces+eligis=[hidden email]] On Behalf Of ian
Sent: Thursday, January 16, 2020 07:03
To: [hidden email]
Subject: *** SPAM *** Re: [Tinycc-devel] Add new _ISOCxx macros?

 

Hi Christian,

It seems consistent to me.

Regards.

Le 16/01/2020 à 06:55, Christian Jullien a écrit :

Hi all,

 

When we use tcc on Linux, we also use /usr/include/*.h.

Some definitions are only visible for C11 and controlled by use of _ISOC11_SOURCE as used by glibc (see for example http://man7.org/linux/man-pages/man7/feature_test_macros.7.html).

 

As tcc is C99 by default, I propose to also automatically set _ISOC99_SOURCE by default but _ISOC11_SOURCE when -std=c11 is used.

 

Wdyt?

 

Reference:

 

    _ISOC99_SOURCE (since glibc 2.1.3)

               Exposes declarations consistent with the ISO C99 standard.

 

               Earlier glibc 2.1.x versions recognized an equivalent macro

               named _ISOC9X_SOURCE (because the C99 standard had not then

               been finalized).  Although the use of this macro is obsolete,

               glibc continues to recognize it for backward compatibility.

 

               Defining _ISOC99_SOURCE also exposes ISO C (1990) Amendment 1

               ("C95") definitions.  (The primary change in C95 was support

               for international character sets.)

 

               Invoking the C compiler with the option -std=c99 produces the

               same effects as defining this macro.

 

       _ISOC11_SOURCE (since glibc 2.16)

               Exposes declarations consistent with the ISO C11 standard.

               Defining this macro also enables C99 and C95 features (like

               _ISOC99_SOURCE).

 

               Invoking the C compiler with the option -std=c11 produces the

               same effects as defining this macro.



_______________________________________________
Tinycc-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

--
-- [hidden email]
-- Développeur compulsif


_______________________________________________
Tinycc-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel
Reply | Threaded
Open this post in threaded view
|

Re: Add new _ISOCxx macros?

Michael Matz-4
Hello,

On Thu, 16 Jan 2020, Christian Jullien wrote:

> Pushed on mob.

The macros _ISOC99_SOURCE and _ISOC11_SOURCE are requests to enable c99
and c11 features of glibc.  They are supposed to come at the request of
users and are interpreted by <features.h> of glibc to set various other
macros.  They aren't defined by gcc.

> Please note that those macros are defined by gcc only when _GNU_SOURCE is
> supplied.

They are defined by glibc itself with _GNU_SOURCE, yes.  But also that is
an explicit user request, the usage or non-usage of -std=c99/c11 doesn't
come into play.  The compiler communicates the level of C standard
compliance by the __STDC_VERSION__ macro.


Ciao,
Michael.

>
> With tcc they are unconditionally defined except on Windows (which does not
> use glibc at all).
>
>  
>
> C.
>
>  
>
> From: Tinycc-devel [mailto:tinycc-devel-bounces+eligis=[hidden email]]
> On Behalf Of ian
> Sent: Thursday, January 16, 2020 07:03
> To: [hidden email]
> Subject: *** SPAM *** Re: [Tinycc-devel] Add new _ISOCxx macros?
>
>  
>
> Hi Christian,
>
> It seems consistent to me.
>
> Regards.
>
> Le 16/01/2020 à 06:55, Christian Jullien a écrit :
>
>       Hi all,
>
>        
>
>       When we use tcc on Linux, we also use /usr/include/*.h.
>
>       Some definitions are only visible for C11 and controlled by use
>       of _ISOC11_SOURCE as used by glibc (see for example
>       http://man7.org/linux/man-pages/man7/feature_test_macros.7.html).
>
>        
>
>       As tcc is C99 by default, I propose to also automatically set
>       _ISOC99_SOURCE by default but _ISOC11_SOURCE when -std=c11 is
>       used.
>
>        
>
>       Wdyt?
>
>        
>
>       Reference:
>
>        
>
>           _ISOC99_SOURCE (since glibc 2.1.3)
>
>                      Exposes declarations consistent with the ISO C99
>       standard.
>
>        
>
>                      Earlier glibc 2.1.x versions recognized an
>       equivalent macro
>
>                      named _ISOC9X_SOURCE (because the C99 standard
>       had not then
>
>                      been finalized).  Although the use of this macro
>       is obsolete,
>
>                      glibc continues to recognize it for backward
>       compatibility.
>
>        
>
>                      Defining _ISOC99_SOURCE also exposes ISO C (1990)
>       Amendment 1
>
>                      ("C95") definitions.  (The primary change in C95
>       was support
>
>                      for international character sets.)
>
>        
>
>                      Invoking the C compiler with the option -std=c99
>       produces the
>
>                      same effects as defining this macro.
>
>        
>
>              _ISOC11_SOURCE (since glibc 2.16)
>
>                      Exposes declarations consistent with the ISO C11
>       standard.
>
>                      Defining this macro also enables C99 and C95
>       features (like
>
>                      _ISOC99_SOURCE).
>
>        
>
>                      Invoking the C compiler with the option -std=c11
>       produces the
>
>                      same effects as defining this macro.
>
>
>
> _______________________________________________
>
> Tinycc-devel mailing list
>
> [hidden email]
>
> https://lists.nongnu.org/mailman/listinfo/tinycc-devel
>
> --
> -- [hidden email]
> -- Développeur compulsif
>
>
>
_______________________________________________
Tinycc-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel