diff options
author | Jakub Jelinek <jakub@redhat.com> | 2016-03-30 14:43:44 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2016-03-30 14:43:44 +0200 |
commit | f1781599a74af4038c322c76a411338c26fe89d9 (patch) | |
tree | 92509d3f44d11cdd142eddccb9922d1feec85319 /libcpp | |
parent | b2e1956a4ec409a16b42f13b992c7453b7f7d57a (diff) |
backport: re PR target/70296 (Incorrect handling of vector X; if X is function-like macro)
Backported from mainline
2016-03-21 Jakub Jelinek <jakub@redhat.com>
PR target/70296
* config/rs6000/rs6000-c.c (rs6000_macro_to_expand): If IDENT is
function-like macro, peek following token(s) if it is followed
by CPP_OPEN_PAREN token with optional padding in between, and
if not, don't treat it like a macro.
* include/cpplib.h (cpp_fun_like_macro_p): New prototype.
* macro.c (cpp_fun_like_macro_p): New function.
* gcc.target/powerpc/altivec-36.c: New test.
From-SVN: r234565
Diffstat (limited to 'libcpp')
-rw-r--r-- | libcpp/ChangeLog | 9 | ||||
-rw-r--r-- | libcpp/include/cpplib.h | 1 | ||||
-rw-r--r-- | libcpp/macro.c | 9 |
3 files changed, 19 insertions, 0 deletions
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog index 7754af842fe..385c3b0bd10 100644 --- a/libcpp/ChangeLog +++ b/libcpp/ChangeLog @@ -1,3 +1,12 @@ +2016-03-30 Jakub Jelinek <jakub@redhat.com> + + Backported from mainline + 2016-03-21 Jakub Jelinek <jakub@redhat.com> + + PR target/70296 + * include/cpplib.h (cpp_fun_like_macro_p): New prototype. + * macro.c (cpp_fun_like_macro_p): New function. + 2016-02-10 Jakub Jelinek <jakub@redhat.com> Backported from mainline diff --git a/libcpp/include/cpplib.h b/libcpp/include/cpplib.h index 2d90ccd0e81..1b731d1a3ad 100644 --- a/libcpp/include/cpplib.h +++ b/libcpp/include/cpplib.h @@ -804,6 +804,7 @@ extern int cpp_avoid_paste (cpp_reader *, const cpp_token *, extern const cpp_token *cpp_get_token (cpp_reader *); extern const cpp_token *cpp_get_token_with_location (cpp_reader *, source_location *); +extern bool cpp_fun_like_macro_p (cpp_hashnode *); extern const unsigned char *cpp_macro_definition (cpp_reader *, cpp_hashnode *); extern void _cpp_backup_tokens (cpp_reader *, unsigned int); diff --git a/libcpp/macro.c b/libcpp/macro.c index 1e0a0b560ba..eb32a6f8c98 100644 --- a/libcpp/macro.c +++ b/libcpp/macro.c @@ -3307,6 +3307,15 @@ check_trad_stringification (cpp_reader *pfile, const cpp_macro *macro, } } +/* Returns true of NODE is a function-like macro. */ +bool +cpp_fun_like_macro_p (cpp_hashnode *node) +{ + return (node->type == NT_MACRO + && (node->flags & (NODE_BUILTIN | NODE_MACRO_ARG)) == 0 + && node->value.macro->fun_like); +} + /* Returns the name, arguments and expansion of a macro, in a format suitable to be read back in again, and therefore also for DWARF 2 debugging info. e.g. "PASTE(X, Y) X ## Y", or "MACNAME EXPANSION". |