diff options
author | hjl <hjl@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-05-30 18:48:59 +0000 |
---|---|---|
committer | hjl <hjl@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-05-30 18:48:59 +0000 |
commit | c93eec39cbd181e3c8eeb272ae00176a19de976d (patch) | |
tree | bd7cc05629321f73e730bb986c10c1dfa3da61b0 /gcc/c-pragma.c | |
parent | 9d97464a872a5a8d611f63181ba8d404535dff39 (diff) | |
download | gcc-c93eec39cbd181e3c8eeb272ae00176a19de976d.tar.gz |
2005-05-30 H.J. Lu <hongjiu.lu@intel.com>
PR middle-end/20303
* c-pragma.c: Include "vec.h".
(handle_pragma_visibility): Use VEC.
* doc/invoke.texi: Remove the nested visibility push limit.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@100371 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-pragma.c')
-rw-r--r-- | gcc/c-pragma.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/gcc/c-pragma.c b/gcc/c-pragma.c index f4801e87c06..bf1c4581a1d 100644 --- a/gcc/c-pragma.c +++ b/gcc/c-pragma.c @@ -34,6 +34,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "c-common.h" #include "output.h" #include "tm_p.h" +#include "vec.h" #include "target.h" #define GCC_BAD(msgid) do { warning (0, msgid); return; } while (0) @@ -585,15 +586,20 @@ maybe_apply_renaming_pragma (tree decl, tree asmname) #ifdef HANDLE_PRAGMA_VISIBILITY static void handle_pragma_visibility (cpp_reader *); +typedef enum symbol_visibility visibility; +DEF_VEC_I (visibility); +DEF_VEC_ALLOC_I (visibility, heap); + /* Sets the default visibility for symbols to something other than that specified on the command line. */ static void handle_pragma_visibility (cpp_reader *dummy ATTRIBUTE_UNUSED) -{ /* Form is #pragma GCC visibility push(hidden)|pop */ - static int visstack [16], visidx; +{ + /* Form is #pragma GCC visibility push(hidden)|pop */ tree x; enum cpp_ttype token; enum { bad, push, pop } action = bad; + static VEC (visibility, heap) *visstack; token = c_lex (&x); if (token == CPP_NAME) @@ -610,14 +616,15 @@ handle_pragma_visibility (cpp_reader *dummy ATTRIBUTE_UNUSED) { if (pop == action) { - if (!visidx) + if (!VEC_length (visibility, visstack)) { GCC_BAD ("No matching push for %<#pragma GCC visibility pop%>"); } else { - default_visibility = visstack[--visidx]; - visibility_options.inpragma = (visidx>0); + default_visibility = VEC_pop (visibility, visstack); + visibility_options.inpragma + = VEC_length (visibility, visstack) != 0; } } else @@ -629,14 +636,11 @@ handle_pragma_visibility (cpp_reader *dummy ATTRIBUTE_UNUSED) { GCC_BAD ("malformed #pragma GCC visibility push"); } - else if (visidx >= 16) - { - GCC_BAD ("No more than sixteen #pragma GCC visibility pushes allowed at once"); - } else { const char *str = IDENTIFIER_POINTER (x); - visstack[visidx++] = default_visibility; + VEC_safe_push (visibility, heap, visstack, + default_visibility); if (!strcmp (str, "default")) default_visibility = VISIBILITY_DEFAULT; else if (!strcmp (str, "internal")) |