diff options
author | Jozef Lawrynowicz <jozef.l@mittosystems.com> | 2019-06-25 09:41:17 +0000 |
---|---|---|
committer | Jozef Lawrynowicz <jozefl@gcc.gnu.org> | 2019-06-25 09:41:17 +0000 |
commit | 5e5803060c3d6db3ff73195db798ffd8e5588e78 (patch) | |
tree | fda90c008ced20c186f8f9f0ce033275edfd0dd4 /gcc/c | |
parent | a7e8a463cd1dbaccf6e7c4fa888768fcd257a30f (diff) | |
download | gcc-5e5803060c3d6db3ff73195db798ffd8e5588e78.zip gcc-5e5803060c3d6db3ff73195db798ffd8e5588e78.tar.gz gcc-5e5803060c3d6db3ff73195db798ffd8e5588e78.tar.bz2 |
Implement alternate "__intN__" form of "__intN" type
gcc/ChangeLog:
* gcc/c-family/c-common.c (c_common_nodes_and_builtins): Define
alternate "__intN__" name for "__intN" types.
* gcc/c/c-parser.c (c_parse_init): Create keyword for "__intN__" type.
* gcc/cp/lex.c (init_reswords): Likewise.
* gcc/config/msp430/msp430.h: Use __int20__ for SIZE_TYPE and
PTRDIFF_TYPE.
* gcc/cp/cp-tree.h (cp_decl_specifier_seq): New bitfield "int_n_alt".
* gcc/c/c-decl.c (declspecs_add_type): Don't pedwarn about "__intN" ISO
C incompatibility if alternate "__intN__" form is used.
* gcc/cp/decl.c (grokdeclarator): Likewise.
* gcc/cp/parser.c (cp_parser_simple_type_specifier): Set
decl_specs->int_n_alt if "__intN__" form is used.
* gcc/gimple-ssa-sprintf.c (build_intmax_type_nodes): Accept "__intN__"
format of "__intN" types for UINTMAX_TYPE.
* gcc/brig/brig-lang.c (brig_build_c_type_nodes): Accept "__intN__"
format of "__intN" types for SIZE_TYPE.
* gcc/lto/lto-lang.c (lto_build_c_type_nodes): Likewise.
* gcc/stor-layout.c (initialize_sizetypes): Accept "__intN__"
format of "__intN" types for SIZETYPE.
* gcc/tree.c (build_common_tree_nodes): Accept "__intN__"
format of "__intN" types for SIZE_TYPE and PTRDIFF_TYPE.
* gcc/doc/invoke.texi: Document that __intN__ disables pedantic
warnings.
gcc/testsuite/ChangeLog:
* gcc.target/msp430/mlarge-pedwarns.c: New test.
From-SVN: r272640
Diffstat (limited to 'gcc/c')
-rw-r--r-- | gcc/c/c-decl.c | 6 | ||||
-rw-r--r-- | gcc/c/c-parser.c | 5 |
2 files changed, 10 insertions, 1 deletions
diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c index 87ce853..cb2f49f 100644 --- a/gcc/c/c-decl.c +++ b/gcc/c/c-decl.c @@ -10637,7 +10637,11 @@ declspecs_add_type (location_t loc, struct c_declspecs *specs, case RID_INT_N_2: case RID_INT_N_3: specs->int_n_idx = i - RID_INT_N_0; - if (!in_system_header_at (input_location)) + if (!in_system_header_at (input_location) + /* If the INT_N type ends in "__", and so is of the format + "__intN__", don't pedwarn. */ + && (strncmp (IDENTIFIER_POINTER (type) + + (IDENTIFIER_LENGTH (type) - 2), "__", 2) != 0)) pedwarn (loc, OPT_Wpedantic, "ISO C does not support %<__int%d%> types", int_n_data[specs->int_n_idx].bitsize); diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c index df1a304..9850872 100644 --- a/gcc/c/c-parser.c +++ b/gcc/c/c-parser.c @@ -157,6 +157,11 @@ c_parse_init (void) id = get_identifier (name); C_SET_RID_CODE (id, RID_FIRST_INT_N + i); C_IS_RESERVED_WORD (id) = 1; + + sprintf (name, "__int%d__", int_n_data[i].bitsize); + id = get_identifier (name); + C_SET_RID_CODE (id, RID_FIRST_INT_N + i); + C_IS_RESERVED_WORD (id) = 1; } } |