[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: |
uso ewin |
Subject: |
Re: [Tinycc-devel] Add max_align_t to stddef.h and C11 |
Date: |
Thu, 10 Jan 2019 11:13:14 +0100 |
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] Add max_align_t to stddef.h and C11, Christian Jullien, 2019/01/08
- Re: [Tinycc-devel] Add max_align_t to stddef.h and C11, Petr Skočík, 2019/01/08
- Re: [Tinycc-devel] Add max_align_t to stddef.h and C11, Christian Jullien, 2019/01/08
- Re: [Tinycc-devel] Add max_align_t to stddef.h and C11, uso ewin, 2019/01/08
- Re: [Tinycc-devel] Add max_align_t to stddef.h and C11, Christian Jullien, 2019/01/08
- Re: [Tinycc-devel] Add max_align_t to stddef.h and C11, uso ewin, 2019/01/08
- Re: [Tinycc-devel] Add max_align_t to stddef.h and C11, Christian Jullien, 2019/01/08
- Re: [Tinycc-devel] Add max_align_t to stddef.h and C11,
uso ewin <=
- Re: [Tinycc-devel] Add max_align_t to stddef.h and C11, Christian Jullien, 2019/01/10
- Re: [Tinycc-devel] Add max_align_t to stddef.h and C11, uso ewin, 2019/01/10
- Re: [Tinycc-devel] Add max_align_t to stddef.h and C11, Petr Skočík, 2019/01/10
- Re: [Tinycc-devel] Add max_align_t to stddef.h and C11, Christian Jullien, 2019/01/11
- Re: [Tinycc-devel] Add max_align_t to stddef.h and C11, uso ewin, 2019/01/11
- Re: [Tinycc-devel] Add max_align_t to stddef.h and C11, Christian Jullien, 2019/01/11
- Re: [Tinycc-devel] Add max_align_t to stddef.h and C11, Michael Matz, 2019/01/12
- Re: [Tinycc-devel] Add max_align_t to stddef.h and C11, Christian Jullien, 2019/01/13
- Re: [Tinycc-devel] Add max_align_t to stddef.h and C11, Michael Matz, 2019/01/21
- Re: [Tinycc-devel] Add max_align_t to stddef.h and C11, Petr Skočík, 2019/01/08