tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] Add max_align_t to stddef.h and C11


From: Christian Jullien
Subject: Re: [Tinycc-devel] Add max_align_t to stddef.h and C11
Date: Thu, 10 Jan 2019 14:46:31 +0100

Matthias, 


I'm happy you like my patch. I was waiting for comments before pushing this
patch.
As you said, no one protested (or care), so it is committed in mod.

It let you add the logic for the C11.

Christian

-----Original Message-----
From: Tinycc-devel [mailto:address@hidden
On Behalf Of uso ewin
Sent: jeudi 10 janvier 2019 11:13
To: address@hidden
Subject: Re: [Tinycc-devel] Add max_align_t to stddef.h and C11

On Tue, Jan 8, 2019 at 6:02 PM Christian Jullien <address@hidden> wrote:
>
> > Maybe add a global variable
>
> Not global but a new member of TCCState, for example cversion
>
> If (s->cversion >= 201112) {
>   /* Hello C11 */
> }
>
> Diff becomes:
>
> address@hidden:~/new-tcc $ git diff
> diff --git a/libtcc.c b/libtcc.c
> index df7adab..7883734 100644
> --- a/libtcc.c
> +++ b/libtcc.c
> @@ -1790,8 +1790,16 @@ reparse:
>              s->static_link = 1;
>              break;
>          case TCC_OPTION_std:
> -           /* silently ignore, a current purpose:
> -              allow to use a tcc as a reference compiler for "make test"
*/
> +            if (*optarg == '=') {
> +                ++optarg;
> +                if (strcmp(optarg, "c11") == 0) {
> +                   tcc_undefine_symbol(s, "__STDC_VERSION__");
> +                   tcc_define_symbol(s, "__STDC_VERSION__", "201112L");
> +                   s->cversion = 201112;
> +                }
> +            }
> +             /* silently ignore other values, a current purpose:
> +                allow to use a tcc as a reference compiler for "make
test"
> */
>              break;
>          case TCC_OPTION_shared:
>              x = TCC_OUTPUT_DLL;
> diff --git a/tcc.c b/tcc.c
> index f780389..2d4e1ea 100644
> --- a/tcc.c
> +++ b/tcc.c
> @@ -33,6 +33,8 @@ static const char help[] =
>      "  -o outfile  set output filename\n"
>      "  -run        run compiled source\n"
>      "  -fflag      set or reset (with 'no-' prefix) 'flag' (see tcc
-hh)\n"
> +    "  -std=c99    Conform to the ISO 1999 C standard (default).\n"
> +    "  -std=c11    Conform to the ISO 2011 C standard.\n"
>      "  -Wwarning   set or reset (with 'no-' prefix) 'warning' (see tcc
> -hh)\n"
>      "  -w          disable all warnings\n"
>      "  -v -vv      show version, show search paths or loaded files\n"
> diff --git a/tcc.h b/tcc.h
> index cc85291..8416cc5 100644
> --- a/tcc.h
> +++ b/tcc.h
> @@ -651,6 +651,7 @@ struct TCCState {
>      int rdynamic; /* if true, all symbols are exported */
>      int symbolic; /* if true, resolve symbols in the current module first
> */
>      int filetype; /* file type for compilation (NONE,C,ASM) */
> +    int cversion; /* supported C ISO version, either 0 (199901), 201112,
> ... */
>
>      char *tcc_lib_path; /* CONFIG_TCCDIR or -B option */
>      char *soname; /* as specified on the command line (-soname) */
>
>
>
> _______________________________________________
> Tinycc-devel mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/tinycc-devel

I like the version with cversion in tcc state.

As no one protest, I guess you can push.
Do you want to patch existing C11 code too ?
if not I can do it, but I need this patch to be merge.

Matthias,

_______________________________________________
Tinycc-devel mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/tinycc-devel




reply via email to

[Prev in Thread] Current Thread [Next in Thread]