1 $DragonFly: src/gnu/usr.bin/cc34/cc_prep/patches/c-pragma.c.patch,v 1.1 2004/12/21 13:10:48 joerg Exp $
3 ===================================================================
4 RCS file: /home/joerg/wd/repository/dragonflybsd/src/contrib/gcc-3.4/gcc/c-pragma.c,v
5 retrieving revision 1.1
6 diff -u -r1.1 c-pragma.c
7 --- c-pragma.c 20 Jun 2004 02:14:48 -0000 1.1
8 +++ c-pragma.c 20 Dec 2004 20:51:37 -0000
14 +#ifdef HANDLE_PRAGMA_VISIBILITY
15 +static void handle_pragma_visibility (cpp_reader *);
17 +/* Sets the default visibility for symbols to something other than that
18 + specified on the command line. */
20 +handle_pragma_visibility (cpp_reader *dummy ATTRIBUTE_UNUSED)
21 +{ /* Form is #pragma GCC visibility push(hidden)|pop */
22 + static int visstack [16], visidx;
24 + enum cpp_ttype token;
25 + enum { bad, push, pop } action = bad;
28 + if (token == CPP_NAME)
30 + const char *op = IDENTIFIER_POINTER (x);
31 + if (!strcmp (op, "push"))
33 + else if (!strcmp (op, "pop"))
37 + GCC_BAD ("#pragma GCC visibility must be followed by push or pop");
44 + GCC_BAD ("No matching push for '#pragma GCC visibility pop'");
48 + default_visibility = visstack[--visidx];
49 + visibility_options.inpragma = (visidx>0);
54 + if (c_lex (&x) != CPP_OPEN_PAREN)
55 + GCC_BAD ("missing '(' after '#pragma GCC visibility push' - ignored");
57 + if (token != CPP_NAME)
59 + GCC_BAD ("malformed #pragma GCC visibility push");
61 + else if (visidx >= 16)
63 + GCC_BAD ("No more than sixteen #pragma GCC visibility pushes allowed at once");
67 + const char *str = IDENTIFIER_POINTER (x);
68 + visstack[visidx++] = default_visibility;
69 + if (!strcmp (str, "default"))
70 + default_visibility = VISIBILITY_DEFAULT;
71 + else if (!strcmp (str, "internal"))
72 + default_visibility = VISIBILITY_INTERNAL;
73 + else if (!strcmp (str, "hidden"))
74 + default_visibility = VISIBILITY_HIDDEN;
75 + else if (!strcmp (str, "protected"))
76 + default_visibility = VISIBILITY_PROTECTED;
79 + GCC_BAD ("#pragma GCC visibility push() must specify default, internal, hidden or protected");
81 + visibility_options.inpragma = 1;
83 + if (c_lex (&x) != CPP_CLOSE_PAREN)
84 + GCC_BAD ("missing '(' after '#pragma GCC visibility push' - ignored");
87 + if (c_lex (&x) != CPP_EOF)
88 + warning ("junk at end of '#pragma GCC visibility'");
93 /* Front-end wrapper for pragma registration to avoid dragging
94 cpplib.h in almost everywhere. */
97 #ifdef HANDLE_PRAGMA_EXTERN_PREFIX
98 c_register_pragma (0, "extern_prefix", handle_pragma_extern_prefix);
100 +#ifdef HANDLE_PRAGMA_VISIBILITY
101 + c_register_pragma ("GCC", "visibility", handle_pragma_visibility);
104 #ifdef REGISTER_TARGET_PRAGMAS
105 REGISTER_TARGET_PRAGMAS ();