From 9f416fac8f180c78e6be63131494c1f1b5161d46 Mon Sep 17 00:00:00 2001 From: Michael Hayes Date: Sat, 16 Dec 2000 23:41:44 +0000 Subject: [PATCH] c4x.h (REGISTER_TARGET_PRAGMAS): Call c4x_init_pragma. * config/c4x/c4x.h (REGISTER_TARGET_PRAGMAS): Call c4x_init_pragma. * config/c4x/c4x-protos.h (c4x_init_pragma): New prototype. * config/c4x/c4x.c (c4x_init_pragma): New function. (c_lex_func): New variable. (c4x_parse_pragma): Use c_lex_func. Co-Authored-By: Herman A.J. ten Brugge From-SVN: r38317 --- gcc/ChangeLog | 11 +++++++++++ gcc/config/c4x/c4x-protos.h | 1 + gcc/config/c4x/c4x.c | 22 ++++++++++++++++------ gcc/config/c4x/c4x.h | 1 + 4 files changed, 29 insertions(+), 6 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1cc24d562f1..1de2a260ba7 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +2000-12-17 Michael Hayes + Herman A.J. ten Brugge + + * config/c4x/c4x.h (REGISTER_TARGET_PRAGMAS): Call c4x_init_pragma. + + * config/c4x/c4x-protos.h (c4x_init_pragma): New prototype. + + * config/c4x/c4x.c (c4x_init_pragma): New function. + (c_lex_func): New variable. + (c4x_parse_pragma): Use c_lex_func. + 2000-12-17 Michael Hayes Herman A.J. ten Brugge diff --git a/gcc/config/c4x/c4x-protos.h b/gcc/config/c4x/c4x-protos.h index 57df4f35274..8c8b77032b7 100644 --- a/gcc/config/c4x/c4x-protos.h +++ b/gcc/config/c4x/c4x-protos.h @@ -308,6 +308,7 @@ extern void c4x_pr_FUNC_IS_PURE PARAMS ((cpp_reader *)); extern void c4x_pr_FUNC_NEVER_RETURNS PARAMS ((cpp_reader *)); extern void c4x_pr_INTERRUPT PARAMS ((cpp_reader *)); extern void c4x_pr_ignored PARAMS ((cpp_reader *)); +extern void c4x_init_pragma PARAMS ((int (*) (tree *))); #endif #endif diff --git a/gcc/config/c4x/c4x.c b/gcc/config/c4x/c4x.c index 7127749b8f1..775c7b6579b 100644 --- a/gcc/config/c4x/c4x.c +++ b/gcc/config/c4x/c4x.c @@ -4391,6 +4391,16 @@ c4x_operand_subword (op, i, validate_address, mode) -1 for a malformed pragma. */ #define BAD(msgid, arg) do { warning (msgid, arg); return -1; } while (0) +static int (*c_lex_func) (tree *); + +void +c4x_init_pragma (get_token) + int (*get_token) PARAMS ((tree *)); +{ + c_lex_func = get_token; +} + + static int c4x_parse_pragma (name, func, sect) const char *name; @@ -4399,25 +4409,25 @@ c4x_parse_pragma (name, func, sect) { tree f, s, x; - if (c_lex (&x) != CPP_OPEN_PAREN) + if (c_lex_func (&x) != CPP_OPEN_PAREN) BAD ("missing '(' after '#pragma %s' - ignored", name); - if (c_lex (&f) != CPP_NAME) + if (c_lex_func (&f) != CPP_NAME) BAD ("missing function name in '#pragma %s' - ignored", name); if (sect) { - if (c_lex (&x) != CPP_COMMA) + if (c_lex_func (&x) != CPP_COMMA) BAD ("malformed '#pragma %s' - ignored", name); - if (c_lex (&s) != CPP_STRING) + if (c_lex_func (&s) != CPP_STRING) BAD ("missing section name in '#pragma %s' - ignored", name); *sect = s; } - if (c_lex (&x) != CPP_CLOSE_PAREN) + if (c_lex_func (&x) != CPP_CLOSE_PAREN) BAD ("missing ')' for '#pragma %s' - ignored", name); - if (c_lex (&x) != CPP_EOF) + if (c_lex_func (&x) != CPP_EOF) warning ("junk at end of '#pragma %s'", name); *func = f; diff --git a/gcc/config/c4x/c4x.h b/gcc/config/c4x/c4x.h index 2b3fe74d385..48345310e6b 100644 --- a/gcc/config/c4x/c4x.h +++ b/gcc/config/c4x/c4x.h @@ -2385,6 +2385,7 @@ asm_fprintf (FILE, "%s%d:\n", PREFIX, NUM) cpp_register_pragma (PFILE, 0, "FUNC_NO_GLOBAL_ASG", c4x_pr_ignored); \ cpp_register_pragma (PFILE, 0, "FUNC_NO_IND_ASG", c4x_pr_ignored); \ cpp_register_pragma (PFILE, 0, "INTERRUPT", c4x_pr_INTERRUPT); \ + c4x_init_pragma (&c_lex); \ } while (0) #define SET_DEFAULT_DECL_ATTRIBUTES(DECL, ATTRIBUTES) \