diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2022-08-24 16:50:14 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-24 16:50:14 +0000 |
commit | d3cf195ab46d7effe806990aa6b7a409bf8e46df (patch) | |
tree | eb33d22a749417ad62a3fc87c2dc8cfb3452632a /libcpp/directives.cc | |
parent | 825a44b40ce6cfa76470e53d0746b1e64b99ee5b (diff) | |
parent | 2e77960b14527ff216fa188479de9142fbb9d34c (diff) | |
download | gcc-d3cf195ab46d7effe806990aa6b7a409bf8e46df.zip gcc-d3cf195ab46d7effe806990aa6b7a409bf8e46df.tar.gz gcc-d3cf195ab46d7effe806990aa6b7a409bf8e46df.tar.bz2 |
Merge #1498
1498: Merge from GCC upstream r=philberty a=philberty
Lets see if it builds.
Co-authored-by: GCC Administrator <gccadmin@gcc.gnu.org>
Co-authored-by: Dimitrije Milošević <dimitrije.milosevic@syrmia.com>
Co-authored-by: Aldy Hernandez <aldyh@redhat.com>
Co-authored-by: Jakub Jelinek <jakub@redhat.com>
Co-authored-by: Martin Liska <mliska@suse.cz>
Co-authored-by: Roger Sayle <roger@nextmovesoftware.com>
Co-authored-by: Sam Feifer <sfeifer@redhat.com>
Co-authored-by: Andrew Stubbs <ams@codesourcery.com>
Co-authored-by: Jose E. Marchesi <jose.marchesi@oracle.com>
Co-authored-by: H.J. Lu <hjl.tools@gmail.com>
Co-authored-by: David Malcolm <dmalcolm@redhat.com>
Co-authored-by: Richard Biener <rguenther@suse.de>
Co-authored-by: Immad Mir <mirimmad@outlook.com>
Diffstat (limited to 'libcpp/directives.cc')
-rw-r--r-- | libcpp/directives.cc | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/libcpp/directives.cc b/libcpp/directives.cc index 60fd274..802bd8c 100644 --- a/libcpp/directives.cc +++ b/libcpp/directives.cc @@ -158,7 +158,7 @@ static void cpp_pop_definition (cpp_reader *, struct def_pragma_macro *); D(elifndef, T_ELIFNDEF, STDC2X, COND | ELIFDEF) \ D(error, T_ERROR, STDC89, 0) \ D(pragma, T_PRAGMA, STDC89, IN_I) \ - D(warning, T_WARNING, EXTENSION, 0) \ + D(warning, T_WARNING, STDC2X, 0) \ D(include_next, T_INCLUDE_NEXT, EXTENSION, INCL | EXPAND) \ D(ident, T_IDENT, EXTENSION, IN_I) \ D(import, T_IMPORT, EXTENSION, INCL | EXPAND) /* ObjC */ \ @@ -385,6 +385,15 @@ directive_diagnostics (cpp_reader *pfile, const directive *dir, int indented) && !(dir == &dtable[T_IMPORT] && CPP_OPTION (pfile, objc)) && CPP_PEDANTIC (pfile)) cpp_error (pfile, CPP_DL_PEDWARN, "#%s is a GCC extension", dir->name); + else if (dir == &dtable[T_WARNING]) + { + if (CPP_PEDANTIC (pfile) && !CPP_OPTION (pfile, warning_directive)) + cpp_error (pfile, CPP_DL_PEDWARN, + "#%s before C2X is a GCC extension", dir->name); + else if (CPP_OPTION (pfile, cpp_warn_c11_c2x_compat) > 0) + cpp_warning (pfile, CPP_W_C11_C2X_COMPAT, + "#%s before C2X is a GCC extension", dir->name); + } else if (((dir->flags & DEPRECATED) != 0 || (dir == &dtable[T_IMPORT] && !CPP_OPTION (pfile, objc))) && CPP_OPTION (pfile, cpp_warn_deprecated)) @@ -1930,6 +1939,7 @@ destringize_and_run (cpp_reader *pfile, const cpp_string *in, maxcount = 50; toks = XNEWVEC (cpp_token, maxcount); toks[0] = pfile->directive_result; + toks[0].src_loc = expansion_loc; do { @@ -1954,8 +1964,7 @@ destringize_and_run (cpp_reader *pfile, const cpp_string *in, else { count = 1; - toks = XNEW (cpp_token); - toks[0] = pfile->directive_result; + toks = &pfile->avoid_paste; /* If we handled the entire pragma internally, make sure we get the line number correct for the next token. */ |