2 diff -aur gcc-3.4.0orig/gcc/c-common.c gcc-3.4.0/gcc/c-common.c
3 --- gcc-3.4.0orig/gcc/c-common.c 2004-03-19 01:32:59.000000000 +0000
4 +++ gcc-3.4.0/gcc/c-common.c 2004-05-10 21:05:33.000000000 +0100
6 handle_deprecated_attribute },
7 { "vector_size", 1, 1, false, true, false,
8 handle_vector_size_attribute },
9 - { "visibility", 1, 1, true, false, false,
10 + { "visibility", 1, 1, false, false, false,
11 handle_visibility_attribute },
12 { "tls_model", 1, 1, true, false, false,
13 handle_tls_model_attribute },
14 @@ -4886,7 +4886,16 @@
18 - if (decl_function_context (decl) != 0 || ! TREE_PUBLIC (decl))
21 + if (TREE_CODE (*node) != RECORD_TYPE && TREE_CODE (*node) != UNION_TYPE)
23 + warning ("`%s' attribute ignored on non-class types",
24 + IDENTIFIER_POINTER (name));
28 + else if (decl_function_context (decl) != 0 || ! TREE_PUBLIC (decl))
30 warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name));
32 @@ -4897,6 +4906,14 @@
33 error ("visibility arg not a string");
37 + /* If this is a type, set the visibility on the type decl. */
40 + decl = TYPE_NAME (decl);
45 if (strcmp (TREE_STRING_POINTER (id), "default") == 0)
46 DECL_VISIBILITY (decl) = VISIBILITY_DEFAULT;
47 @@ -4908,6 +4925,14 @@
48 DECL_VISIBILITY (decl) = VISIBILITY_PROTECTED;
50 error ("visibility arg must be one of \"default\", \"hidden\", \"protected\" or \"internal\"");
51 + DECL_VISIBILITYSPECIFIED (decl) = 1;
53 + /* For decls only, go ahead and attach the attribute to the node as well.
54 + This is needed so we can determine whether we have VISIBILITY_DEFAULT
55 + because the visibility was not specified, or because it was explicitly
56 + overridden from the class visibility. */
58 + *no_add_attrs = false;
63 diff -aur gcc-3.4.0orig/gcc/c-decl.c gcc-3.4.0/gcc/c-decl.c
64 --- gcc-3.4.0orig/gcc/c-decl.c 2004-03-22 17:58:18.000000000 +0000
65 +++ gcc-3.4.0/gcc/c-decl.c 2004-05-10 15:16:27.000000000 +0100
70 - /* All decls must agree on a non-default visibility. */
71 - if (DECL_VISIBILITY (newdecl) != VISIBILITY_DEFAULT
72 - && DECL_VISIBILITY (olddecl) != VISIBILITY_DEFAULT
73 + /* All decls must agree on a visibility. */
74 + if (DECL_VISIBILITYSPECIFIED (newdecl) && DECL_VISIBILITYSPECIFIED (olddecl)
75 && DECL_VISIBILITY (newdecl) != DECL_VISIBILITY (olddecl))
77 warning ("%Jredeclaration of '%D' with different visibility "
78 @@ -1361,9 +1360,12 @@
79 Currently, it can only be defined in the prototype. */
80 COPY_DECL_ASSEMBLER_NAME (olddecl, newdecl);
82 - /* If either declaration has a nondefault visibility, use it. */
83 - if (DECL_VISIBILITY (olddecl) != VISIBILITY_DEFAULT)
84 - DECL_VISIBILITY (newdecl) = DECL_VISIBILITY (olddecl);
85 + /* Use visibility of whichever declaration had it specified */
86 + if (DECL_VISIBILITYSPECIFIED (olddecl))
88 + DECL_VISIBILITY (newdecl) = DECL_VISIBILITY (olddecl);
89 + DECL_VISIBILITYSPECIFIED (newdecl) = 1;
92 if (TREE_CODE (newdecl) == FUNCTION_DECL)
95 diff -aur gcc-3.4.0orig/gcc/common.opt gcc-3.4.0/gcc/common.opt
96 --- gcc-3.4.0orig/gcc/common.opt 2004-02-18 00:09:04.000000000 +0000
97 +++ gcc-3.4.0/gcc/common.opt 2004-05-09 08:10:50.000000000 +0100
100 Add extra commentary to assembler output
103 +Common Joined RejectNegative
104 +-fvisibility=[default|internal|hidden|protected] Set the default symbol visibility
109 Use expression value profiles in optimizations
111 diff -aur gcc-3.4.0orig/gcc/c.opt gcc-3.4.0/gcc/c.opt
112 --- gcc-3.4.0orig/gcc/c.opt 2004-02-18 00:09:03.000000000 +0000
113 +++ gcc-3.4.0/gcc/c.opt 2004-05-09 08:10:50.000000000 +0100
116 Use __cxa_atexit to register destructors
118 +fvisibility-inlines-hidden
120 +Marks all inlined methods as having hidden visibility
124 Discard unused virtual functions
125 diff -aur gcc-3.4.0orig/gcc/c-opts.c gcc-3.4.0/gcc/c-opts.c
126 --- gcc-3.4.0orig/gcc/c-opts.c 2004-02-18 00:09:03.000000000 +0000
127 +++ gcc-3.4.0/gcc/c-opts.c 2004-05-09 08:10:50.000000000 +0100
129 case OPT_fuse_cxa_atexit:
130 flag_use_cxa_atexit = value;
133 + case OPT_fvisibility_inlines_hidden:
134 + visibility_options.inlineshidden = value;
140 diff -aur gcc-3.4.0orig/gcc/cp/class.c gcc-3.4.0/gcc/cp/class.c
141 --- gcc-3.4.0orig/gcc/cp/class.c 2004-03-09 07:27:23.000000000 +0000
142 +++ gcc-3.4.0/gcc/cp/class.c 2004-05-10 21:06:50.000000000 +0100
144 DECL_ALIGN (decl) = MAX (TYPE_ALIGN (double_type_node),
147 + /* The vtable's visibility is the class visibility. There is no way
148 + to override the visibility for just the vtable. */
149 + DECL_VISIBILITY (decl) = CLASSTYPE_VISIBILITY (class_type);
150 + DECL_VISIBILITYSPECIFIED (decl) = CLASSTYPE_VISIBILITYSPECIFIED (class_type);
151 import_export_vtable (decl, class_type, 0);
154 @@ -2971,7 +2975,25 @@
157 if (TREE_CODE (x) == CONST_DECL || TREE_CODE (x) == VAR_DECL)
160 + /* Apply the class's visibility attribute to static members
161 + which do not have a visibility attribute. */
162 + if (! lookup_attribute ("visibility", DECL_ATTRIBUTES (x)))
164 + if (visibility_options.inlineshidden && DECL_INLINE (x))
166 + DECL_VISIBILITY (x) = VISIBILITY_HIDDEN;
167 + DECL_VISIBILITYSPECIFIED (x) = 1;
171 + DECL_VISIBILITY (x) = CLASSTYPE_VISIBILITY (current_class_type);
172 + DECL_VISIBILITYSPECIFIED (x) = CLASSTYPE_VISIBILITYSPECIFIED (current_class_type);
179 /* Now it can only be a FIELD_DECL. */
181 @@ -3708,6 +3730,22 @@
182 check_for_override (x, t);
183 if (DECL_PURE_VIRTUAL_P (x) && ! DECL_VINDEX (x))
184 cp_error_at ("initializer specified for non-virtual method `%D'", x);
186 + /* Apply the class's visibility attribute to methods which do
187 + not have a visibility attribute. */
188 + if (! lookup_attribute ("visibility", DECL_ATTRIBUTES (x)))
190 + if (visibility_options.inlineshidden && DECL_INLINE (x))
192 + DECL_VISIBILITY (x) = VISIBILITY_HIDDEN;
193 + DECL_VISIBILITYSPECIFIED (x) = 1;
197 + DECL_VISIBILITY (x) = CLASSTYPE_VISIBILITY (current_class_type);
198 + DECL_VISIBILITYSPECIFIED (x) = CLASSTYPE_VISIBILITYSPECIFIED (current_class_type);
202 /* The name of the field is the original field name
203 Save this in auxiliary field for later overloading. */
204 @@ -7830,3 +7868,4 @@
205 *vid->last_init = build_tree_list (NULL_TREE, init);
206 vid->last_init = &TREE_CHAIN (*vid->last_init);
210 diff -aur gcc-3.4.0orig/gcc/cp/cp-tree.h gcc-3.4.0/gcc/cp/cp-tree.h
211 --- gcc-3.4.0orig/gcc/cp/cp-tree.h 2004-03-20 00:13:08.000000000 +0000
212 +++ gcc-3.4.0/gcc/cp/cp-tree.h 2004-05-10 20:56:56.000000000 +0100
213 @@ -1008,7 +1008,12 @@
214 #define PUBLICLY_UNIQUELY_DERIVED_P(PARENT, TYPE) \
215 (lookup_base ((TYPE), (PARENT), ba_not_special | ba_quiet, NULL) \
219 +/* Gives the visibility specification for a class type. */
220 +#define CLASSTYPE_VISIBILITY(TYPE) DECL_VISIBILITY (TYPE_NAME (TYPE))
221 +#define CLASSTYPE_VISIBILITYSPECIFIED(TYPE) DECL_VISIBILITYSPECIFIED (TYPE_NAME (TYPE))
224 /* This is a few header flags for 'struct lang_type'. Actually,
225 all but the first are used only for lang_type_class; they
226 are put in this structure to save space. */
228 diff -aur gcc-3.4.0orig/gcc/cp/decl.c gcc-3.4.0/gcc/cp/decl.c
229 --- gcc-3.4.0orig/gcc/cp/decl.c 2004-04-01 21:47:21.000000000 +0100
230 +++ gcc-3.4.0/gcc/cp/decl.c 2004-05-28 21:16:11.000000000 +0100
231 @@ -1869,17 +1869,34 @@
232 DECL_COMMON (newdecl) = DECL_COMMON (olddecl);
233 COPY_DECL_ASSEMBLER_NAME (olddecl, newdecl);
235 - /* If either declaration has a nondefault visibility, use it. */
236 - if (DECL_VISIBILITY (olddecl) != VISIBILITY_DEFAULT)
237 + /* Warn about conflicting visibility specifications. */
238 + if (DECL_VISIBILITYSPECIFIED (olddecl) && DECL_VISIBILITYSPECIFIED (newdecl)
239 + && DECL_VISIBILITY (newdecl) != DECL_VISIBILITY (olddecl))
241 + warning ("%J'%D': visibility attribute ignored because it",
243 + warning ("%Jconflicts with previous declaration here", olddecl);
245 + /* Choose the declaration which specified visibility. */
246 + if (DECL_VISIBILITYSPECIFIED (olddecl))
248 - if (DECL_VISIBILITY (newdecl) != VISIBILITY_DEFAULT
249 - && DECL_VISIBILITY (newdecl) != DECL_VISIBILITY (olddecl))
251 - warning ("%J'%D': visibility attribute ignored because it",
253 - warning ("%Jconflicts with previous declaration here", olddecl);
255 DECL_VISIBILITY (newdecl) = DECL_VISIBILITY (olddecl);
256 + DECL_VISIBILITYSPECIFIED (newdecl) = 1;
258 + /* If it's a definition of a global operator new or operator
259 + delete, it must be default visibility. */
260 + if (NEW_DELETE_OPNAME_P (DECL_NAME (newdecl)) && DECL_INITIAL (newdecl) != NULL_TREE)
262 + if (!DECL_FUNCTION_MEMBER_P (newdecl) && VISIBILITY_DEFAULT != DECL_VISIBILITY (newdecl))
264 + warning ("%J`%D': ignoring non-default symbol",
266 + warning ("%Jvisibility on global operator new or delete", newdecl);
267 + DECL_VISIBILITY (olddecl) = VISIBILITY_DEFAULT;
268 + DECL_VISIBILITYSPECIFIED (olddecl) = 1;
269 + DECL_VISIBILITY (newdecl) = VISIBILITY_DEFAULT;
270 + DECL_VISIBILITYSPECIFIED (newdecl) = 1;
274 if (TREE_CODE (newdecl) == FUNCTION_DECL)
276 diff -aur gcc-3.4.0orig/gcc/cp/method.c gcc-3.4.0/gcc/cp/method.c
277 --- gcc-3.4.0orig/gcc/cp/method.c 2004-04-08 23:15:58.000000000 +0100
278 +++ gcc-3.4.0/gcc/cp/method.c 2004-05-09 08:10:52.000000000 +0100
281 TREE_PUBLIC (thunk_fndecl) = TREE_PUBLIC (function);
282 DECL_VISIBILITY (thunk_fndecl) = DECL_VISIBILITY (function);
283 + DECL_VISIBILITYSPECIFIED (thunk_fndecl) = DECL_VISIBILITYSPECIFIED (function);
285 if (flag_syntax_only)
288 diff -aur gcc-3.4.0orig/gcc/cp/optimize.c gcc-3.4.0/gcc/cp/optimize.c
289 --- gcc-3.4.0orig/gcc/cp/optimize.c 2004-02-08 01:52:50.000000000 +0000
290 +++ gcc-3.4.0/gcc/cp/optimize.c 2004-05-09 08:10:52.000000000 +0100
292 DECL_NOT_REALLY_EXTERN (clone) = DECL_NOT_REALLY_EXTERN (fn);
293 TREE_PUBLIC (clone) = TREE_PUBLIC (fn);
294 DECL_VISIBILITY (clone) = DECL_VISIBILITY (fn);
295 + DECL_VISIBILITYSPECIFIED (clone) = DECL_VISIBILITYSPECIFIED (fn);
297 /* Adjust the parameter names and locations. */
298 parm = DECL_ARGUMENTS (fn);
300 diff -aur gcc-3.4.0orig/gcc/cp/rtti.c gcc-3.4.0/gcc/cp/rtti.c
301 --- gcc-3.4.0orig/gcc/cp/rtti.c 2004-03-08 23:00:26.000000000 +0000
302 +++ gcc-3.4.0/gcc/cp/rtti.c 2004-05-10 21:09:21.000000000 +0100
304 pushdecl_top_level_and_finish (d, NULL_TREE);
306 if (CLASS_TYPE_P (type))
307 - CLASSTYPE_TYPEINFO_VAR (TYPE_MAIN_VARIANT (type)) = d;
309 + CLASSTYPE_TYPEINFO_VAR (TYPE_MAIN_VARIANT (type)) = d;
310 + DECL_VISIBILITY (d) = CLASSTYPE_VISIBILITY (type);
311 + DECL_VISIBILITYSPECIFIED (d) = CLASSTYPE_VISIBILITYSPECIFIED (type);
314 /* Remember the type it is for. */
315 TREE_TYPE (name) = type;
317 TREE_STATIC (name_decl) = 1;
318 DECL_EXTERNAL (name_decl) = 0;
319 TREE_PUBLIC (name_decl) = 1;
320 + if (CLASS_TYPE_P (target))
322 + DECL_VISIBILITY (name_decl) = CLASSTYPE_VISIBILITY (target);
323 + DECL_VISIBILITYSPECIFIED (name_decl) = CLASSTYPE_VISIBILITYSPECIFIED (target);
325 import_export_tinfo (name_decl, target, typeinfo_in_lib_p (target));
326 /* External name of the string containing the type's name has a
329 diff -aur gcc-3.4.0orig/gcc/c-pragma.c gcc-3.4.0/gcc/c-pragma.c
330 --- gcc-3.4.0orig/gcc/c-pragma.c 2004-01-23 23:35:53.000000000 +0000
331 +++ gcc-3.4.0/gcc/c-pragma.c 2004-05-09 08:10:52.000000000 +0100
337 +#ifdef HANDLE_PRAGMA_VISIBILITY
338 +static void handle_pragma_visibility (cpp_reader *);
340 +/* Sets the default visibility for symbols to something other than that
341 + specified on the command line. */
343 +handle_pragma_visibility (cpp_reader *dummy ATTRIBUTE_UNUSED)
344 +{ /* Form is #pragma GCC visibility push(hidden)|pop */
345 + static int visstack [16], visidx;
347 + enum cpp_ttype token;
348 + enum { bad, push, pop } action = bad;
350 + token = c_lex (&x);
351 + if (token == CPP_NAME)
353 + const char *op = IDENTIFIER_POINTER (x);
354 + if (!strcmp (op, "push"))
356 + else if (!strcmp (op, "pop"))
360 + GCC_BAD ("#pragma GCC visibility must be followed by push or pop");
367 + GCC_BAD ("No matching push for '#pragma GCC visibility pop'");
371 + default_visibility = visstack[--visidx];
372 + visibility_options.inpragma = (visidx>0);
377 + if (c_lex (&x) != CPP_OPEN_PAREN)
378 + GCC_BAD ("missing '(' after '#pragma GCC visibility push' - ignored");
379 + token = c_lex (&x);
380 + if (token != CPP_NAME)
382 + GCC_BAD ("malformed #pragma GCC visibility push");
384 + else if (visidx >= 16)
386 + GCC_BAD ("No more than sixteen #pragma GCC visibility pushes allowed at once");
390 + const char *str = IDENTIFIER_POINTER (x);
391 + visstack[visidx++] = default_visibility;
392 + if (!strcmp (str, "default"))
393 + default_visibility = VISIBILITY_DEFAULT;
394 + else if (!strcmp (str, "internal"))
395 + default_visibility = VISIBILITY_INTERNAL;
396 + else if (!strcmp (str, "hidden"))
397 + default_visibility = VISIBILITY_HIDDEN;
398 + else if (!strcmp (str, "protected"))
399 + default_visibility = VISIBILITY_PROTECTED;
402 + GCC_BAD ("#pragma GCC visibility push() must specify default, internal, hidden or protected");
404 + visibility_options.inpragma = 1;
406 + if (c_lex (&x) != CPP_CLOSE_PAREN)
407 + GCC_BAD ("missing '(' after '#pragma GCC visibility push' - ignored");
410 + if (c_lex (&x) != CPP_EOF)
411 + warning ("junk at end of '#pragma GCC visibility'");
416 /* Front-end wrapper for pragma registration to avoid dragging
417 cpplib.h in almost everywhere. */
420 #ifdef HANDLE_PRAGMA_EXTERN_PREFIX
421 c_register_pragma (0, "extern_prefix", handle_pragma_extern_prefix);
423 +#ifdef HANDLE_PRAGMA_VISIBILITY
424 + c_register_pragma ("GCC", "visibility", handle_pragma_visibility);
427 #ifdef REGISTER_TARGET_PRAGMAS
428 REGISTER_TARGET_PRAGMAS ();
429 diff -aur gcc-3.4.0orig/gcc/c-pragma.h gcc-3.4.0/gcc/c-pragma.h
430 --- gcc-3.4.0orig/gcc/c-pragma.h 2004-01-31 06:18:05.000000000 +0000
431 +++ gcc-3.4.0/gcc/c-pragma.h 2004-05-09 08:10:53.000000000 +0100
433 #define HANDLE_PRAGMA_PACK 1
434 #endif /* HANDLE_PRAGMA_PACK_PUSH_POP */
436 +/* It's safe to always leave visibility pragma enabled as if
437 + visibility is not supported on the host OS platform the
438 + statements are ignored. */
439 +#define HANDLE_PRAGMA_VISIBILITY 1
441 extern void init_pragma (void);
443 /* Front-end wrapper for pragma registration to avoid dragging
446 diff -aur gcc-3.4.0orig/gcc/doc/invoke.texi gcc-3.4.0/gcc/doc/invoke.texi
447 --- gcc-3.4.0orig/gcc/doc/invoke.texi 2004-04-19 00:05:36.000000000 +0100
448 +++ gcc-3.4.0/gcc/doc/invoke.texi 2004-05-28 21:29:36.000000000 +0100
450 -fno-optional-diags -fpermissive @gol
451 -frepo -fno-rtti -fstats -ftemplate-depth-@var{n} @gol
452 -fuse-cxa-atexit -fno-weak -nostdinc++ @gol
453 --fno-default-inline -Wabi -Wctor-dtor-privacy @gol
454 +-fno-default-inline -fvisibility-inlines-hidden @gol
455 +-Wabi -Wctor-dtor-privacy @gol
456 -Wnon-virtual-dtor -Wreorder @gol
457 -Weffc++ -Wno-deprecated @gol
458 -Wno-non-template-friend -Wold-style-cast @gol
460 -fargument-alias -fargument-noalias @gol
461 -fargument-noalias-global -fleading-underscore @gol
462 -ftls-model=@var{model} @gol
463 --ftrapv -fwrapv -fbounds-check}
464 +-ftrapv -fwrapv -fbounds-check @gol
469 @@ -1433,6 +1435,20 @@
470 destructors, but will only work if your C library supports
473 +@item -fvisibility-inlines-hidden
474 +@opindex fvisibility-inlines-hidden
475 +Causes all inlined methods to be marked with
476 +@code{__attribute__ ((visibility ("hidden")))} so that they do not
477 +appear in the export table of a DSO and do not require a PLT indirection
478 +when used within the DSO. Enabling this option can have a dramatic effect
479 +on load and link times of a DSO as it massively reduces the size of the
480 +dynamic export table when the library makes heavy use of templates. While
481 +it can cause bloating through duplication of code within each DSO where
482 +it is used, often the wastage is less than the considerable space occupied
483 +by a long symbol name in the export table which is typical when using
484 +templates and namespaces. For even more savings, combine with the
485 +@code{-fvisibility=hidden} switch.
489 Do not use weak symbol support, even if it is provided by the linker.
490 @@ -11198,6 +11214,54 @@
492 The default without @option{-fpic} is @code{initial-exec}; with
493 @option{-fpic} the default is @code{global-dynamic}.
495 +@item -fvisibility=@var{default|internal|hidden|protected}
496 +@opindex fvisibility
497 +Set the default ELF image symbol visibility to the specified option - all
498 +symbols will be marked with this unless overrided within the code.
499 +Using this feature can very substantially improve linking and
500 +load times of shared object libraries, produce more optimised
501 +code, provide near-perfect API export and prevent symbol clashes.
502 +It is @strong{strongly} recommended that you use this in any shared objects
505 +Despite the nomenclature, @code{default} always means public ie;
506 +available to be linked against from outside the shared object.
507 +@code{protected} and @code{internal} are pretty useless in real-world
508 +usage so the only other commonly used option will be @code{hidden}.
509 +The default if -fvisibility isn't specified is @code{default} ie; make every
510 +symbol public - this causes the same behaviour as previous versions of
513 +A good explanation of the benefits offered by ensuring ELF
514 +symbols have the correct visibility is given by ``How To Write
515 +Shared Libraries'' by Ulrich Drepper (which can be found at
516 +@w{@uref{http://people.redhat.com/~drepper/}}) - however a superior
517 +solution made possible by this option to marking things hidden when
518 +the default is public is to make the default hidden and mark things
519 +public. This is the norm with DLL's on Windows and with @option{-fvisibility=hidden}
520 +and @code{__attribute__ ((visibility("default")))} instead of
521 +@code{__declspec(dllexport)} you get almost identical semantics with
522 +identical syntax. This is a great boon to those working with
523 +cross-platform projects.
525 +For those adding visibility support to existing code, you may find
526 +@samp{#pragma GCC visibility} of use. This works by you enclosing
527 +the declarations you wish to set visibility for with (for example)
528 +@samp{#pragma GCC visibility push(hidden)} and
529 +@samp{#pragma GCC visibility pop}. These can be nested up to sixteen
530 +times. Bear in mind that symbol visibility should be viewed @strong{as
531 +part of the API interface contract} and thus all new code should
532 +always specify visibility when it is not the default ie; declarations
533 +only for use within the local DSO should @strong{always} be marked explicitly
534 +as hidden as so to avoid PLT indirection overheads - making this
535 +abundantly clear also aids readability and self-documentation of the code.
536 +Note that due to ISO C++ specification requirements, operator new and
537 +operator delete must always be of default visibility.
539 +An overview of these techniques, their benefits and how to use them
540 +is at @w{@uref{http://www.nedprod.com/programs/gccvisibility.html}}.
546 diff -aur gcc-3.4.0orig/gcc/flags.h gcc-3.4.0/gcc/flags.h
547 --- gcc-3.4.0orig/gcc/flags.h 2004-02-18 00:09:04.000000000 +0000
548 +++ gcc-3.4.0/gcc/flags.h 2004-05-09 08:10:53.000000000 +0100
550 /* Nonzero means emit debugging information only for symbols which are used. */
551 extern int flag_debug_only_used_symbols;
553 +/* Enumerate visibility settings. */
554 +#ifndef SYMBOL_VISIBILITY_DEFINED
555 +#define SYMBOL_VISIBILITY_DEFINED
556 +enum symbol_visibility
558 + VISIBILITY_DEFAULT,
559 + VISIBILITY_INTERNAL,
561 + VISIBILITY_PROTECTED
565 +/* The default visibility for all symbols (unless overridden). */
566 +extern enum symbol_visibility default_visibility;
568 +struct visibility_flags
570 + unsigned inpragma : 1; /* True when in #pragma GCC visibility. */
571 + unsigned inlineshidden : 1; /* True when -finlineshidden in effect. */
574 +/* Global visibility options. */
575 +extern struct visibility_flags visibility_options;
577 /* Nonzero means do optimizations. -opt. */
581 diff -aur gcc-3.4.0orig/gcc/opts.c gcc-3.4.0/gcc/opts.c
582 --- gcc-3.4.0orig/gcc/opts.c 2004-02-18 00:09:04.000000000 +0000
583 +++ gcc-3.4.0/gcc/opts.c 2004-05-09 08:10:53.000000000 +0100
585 write_symbols is set to DBX_DEBUG, XCOFF_DEBUG, or DWARF_DEBUG. */
586 bool use_gnu_debug_info_extensions;
588 +/* The default visibility for all symbols (unless overridden) */
589 +enum symbol_visibility default_visibility = VISIBILITY_DEFAULT;
591 +/* Global visibility options. */
592 +struct visibility_flags visibility_options;
594 /* Columns of --help display. */
595 static unsigned int columns = 80;
597 @@ -1440,6 +1446,21 @@
598 flag_verbose_asm = value;
601 + case OPT_fvisibility_:
603 + if(!strcmp(arg, "default"))
604 + default_visibility=VISIBILITY_DEFAULT;
605 + else if(!strcmp(arg, "internal"))
606 + default_visibility=VISIBILITY_INTERNAL;
607 + else if(!strcmp(arg, "hidden"))
608 + default_visibility=VISIBILITY_HIDDEN;
609 + else if(!strcmp(arg, "protected"))
610 + default_visibility=VISIBILITY_PROTECTED;
612 + error("unrecognised visibility value \"%s\"", arg);
620 diff -aur gcc-3.4.0orig/gcc/tree.c gcc-3.4.0/gcc/tree.c
621 --- gcc-3.4.0orig/gcc/tree.c 2004-02-05 22:01:35.000000000 +0000
622 +++ gcc-3.4.0/gcc/tree.c 2004-05-10 15:22:52.000000000 +0100
623 @@ -2563,6 +2563,11 @@
625 else if (code == FUNCTION_DECL)
626 DECL_MODE (t) = FUNCTION_MODE;
628 + /* Set default visibility to whatever the user supplied with
629 + visibility_specified depending on #pragma GCC visibility. */
630 + DECL_VISIBILITY (t) = default_visibility;
631 + DECL_VISIBILITYSPECIFIED (t) = visibility_options.inpragma;
636 diff -aur gcc-3.4.0orig/gcc/tree.h gcc-3.4.0/gcc/tree.h
637 --- gcc-3.4.0orig/gcc/tree.h 2004-02-08 01:52:43.000000000 +0000
638 +++ gcc-3.4.0/gcc/tree.h 2004-05-09 08:10:54.000000000 +0100
639 @@ -1499,6 +1499,10 @@
640 /* Value of the decls's visibility attribute */
641 #define DECL_VISIBILITY(NODE) (DECL_CHECK (NODE)->decl.visibility)
643 +/* Nonzero means that the decl had its visibility specified rather than
645 +#define DECL_VISIBILITYSPECIFIED(NODE) (DECL_CHECK (NODE)->decl.visibility_specified)
647 /* In a FUNCTION_DECL, nonzero if the function cannot be inlined. */
648 #define DECL_UNINLINABLE(NODE) (FUNCTION_DECL_CHECK (NODE)->decl.uninlinable)
650 @@ -1633,7 +1637,8 @@
651 || TREE_CODE (DECL_CONTEXT (EXP)) == TRANSLATION_UNIT_DECL)
653 /* Enumerate visibility settings. */
655 +#ifndef SYMBOL_VISIBILITY_DEFINED
656 +#define SYMBOL_VISIBILITY_DEFINED
657 enum symbol_visibility
660 @@ -1641,6 +1646,7 @@
668 @@ -1684,8 +1690,7 @@
669 unsigned thread_local_flag : 1;
670 unsigned declared_inline_flag : 1;
671 ENUM_BITFIELD(symbol_visibility) visibility : 2;
672 - unsigned unused : 1;
673 - /* one unused bit. */
674 + unsigned visibility_specified : 1;
676 unsigned lang_flag_0 : 1;
677 unsigned lang_flag_1 : 1;
679 diff -aur gcc-3.4.0orig/gcc/varasm.c gcc-3.4.0/gcc/varasm.c
680 --- gcc-3.4.0orig/gcc/varasm.c 2004-04-14 22:14:08.000000000 +0100
681 +++ gcc-3.4.0/gcc/varasm.c 2004-05-09 08:10:54.000000000 +0100
682 @@ -5150,8 +5150,8 @@
683 /* Static variables are always local. */
684 else if (! TREE_PUBLIC (exp))
686 - /* A variable is local if the user tells us so. */
687 - else if (DECL_VISIBILITY (exp) != VISIBILITY_DEFAULT)
688 + /* A variable is local if the user explicitly tells us so. */
689 + else if (DECL_VISIBILITYSPECIFIED (exp) && DECL_VISIBILITY (exp) != VISIBILITY_DEFAULT)
691 /* Otherwise, variables defined outside this object may not be local. */
692 else if (DECL_EXTERNAL (exp))
693 @@ -5159,6 +5159,9 @@
694 /* Linkonce and weak data are never local. */
695 else if (DECL_ONE_ONLY (exp) || DECL_WEAK (exp))
697 + /* If none of the above and visibility is not default, make local. */
698 + else if (DECL_VISIBILITY (exp) != VISIBILITY_DEFAULT)
700 /* If PIC, then assume that any global name can be overridden by
701 symbols resolved from other modules. */
704 diff -Naur gcc-3.4.0orig/gcc/testsuite/gcc.dg/visibility-9.c gcc-3.4.0/gcc/testsuite/gcc.dg/visibility-9.c
705 --- gcc-3.4.0orig/gcc/testsuite/gcc.dg/visibility-9.c 1970-01-01 01:00:00.000000000 +0100
706 +++ gcc-3.4.0/gcc/testsuite/gcc.dg/visibility-9.c 2004-05-09 12:40:39.000000000 +0100
708 +/* Test that -fvisibility works. */
709 +/* { dg-do compile } */
710 +/* { dg-require-visibility "" } */
711 +/* { dg-options "-fvisibility=hidden" } */
712 +/* { dg-final { scan-assembler "\\.hidden.*foo" } } */
717 diff -Naur gcc-3.4.0orig/gcc/testsuite/gcc.dg/visibility-a.c gcc-3.4.0/gcc/testsuite/gcc.dg/visibility-a.c
718 --- gcc-3.4.0orig/gcc/testsuite/gcc.dg/visibility-a.c 1970-01-01 01:00:00.000000000 +0100
719 +++ gcc-3.4.0/gcc/testsuite/gcc.dg/visibility-a.c 2004-05-09 12:55:04.000000000 +0100
721 +/* Test that #pragma GCC visibility works. */
722 +/* { dg-do compile } */
723 +/* { dg-require-visibility "" } */
724 +/* { dg-final { scan-assembler "\\.hidden.*foo" } } */
726 +#pragma GCC visibility push(hidden)
728 +#pragma GCC visibility pop
731 diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/fvisibility.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/fvisibility.C
732 --- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/fvisibility.C 1970-01-01 01:00:00.000000000 +0100
733 +++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/fvisibility.C 2004-05-09 19:17:13.000000000 +0100
735 +/* Test that -fvisibility affects class members. */
736 +/* { dg-do compile } */
737 +/* { dg-require-visibility "" } */
738 +/* { dg-options "-fvisibility=hidden" } */
739 +/* { dg-final { scan-assembler "\\.hidden.*Foo.methodEv" } } */
746 +void Foo::method() { }
747 diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/fvisibility-inlines-hidden.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/fvisibility-inlines-hidden.C
748 --- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/fvisibility-inlines-hidden.C 1970-01-01 01:00:00.000000000 +0100
749 +++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/fvisibility-inlines-hidden.C 2004-05-09 19:17:59.000000000 +0100
751 +/* Test that -fvisibility-inlines-hidden affects class members. */
752 +/* { dg-do compile } */
753 +/* { dg-require-visibility "" } */
754 +/* { dg-options "-fvisibility-inlines-hidden" } */
755 +/* { dg-final { scan-assembler "\\.hidden.*Foo.methodEv" } } */
769 diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/fvisibility-override1.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/fvisibility-override1.C
770 --- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/fvisibility-override1.C 1970-01-01 01:00:00.000000000 +0100
771 +++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/fvisibility-override1.C 2004-05-09 19:18:06.000000000 +0100
773 +/* Test that -fvisibility does not override class member specific settings. */
774 +/* { dg-do compile } */
775 +/* { dg-require-visibility "" } */
776 +/* { dg-options "-fvisibility=hidden" } */
777 +/* { dg-final { scan-assembler "\\.internal.*Foo.methodEv" } } */
779 +class __attribute__ ((visibility ("internal"))) Foo
784 +void Foo::method() { }
785 diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/fvisibility-override2.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/fvisibility-override2.C
786 --- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/fvisibility-override2.C 1970-01-01 01:00:00.000000000 +0100
787 +++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/fvisibility-override2.C 2004-05-09 19:18:12.000000000 +0100
789 +/* Test that -fvisibility does not override class member specific settings. */
790 +/* { dg-do compile } */
791 +/* { dg-require-visibility "" } */
792 +/* { dg-options "-fvisibility=hidden" } */
793 +/* { dg-final { scan-assembler "\\.internal.*Foo.methodEv" } } */
797 + __attribute__ ((visibility ("internal"))) void method();
800 +void Foo::method() { }
801 diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/memfuncts.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/memfuncts.C
802 --- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/memfuncts.C 1970-01-01 01:00:00.000000000 +0100
803 +++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/memfuncts.C 2004-05-09 19:18:19.000000000 +0100
805 +/* Test that setting visibility for class member functions works. */
806 +/* { dg-do compile } */
807 +/* { dg-require-visibility "" } */
808 +/* { dg-final { scan-assembler "\\.hidden.*Foo.methodEv" } } */
810 +class __attribute__ ((visibility ("hidden"))) Foo
815 +void Foo::method() { }
816 diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/noPLT.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/noPLT.C
817 --- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/noPLT.C 1970-01-01 01:00:00.000000000 +0100
818 +++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/noPLT.C 2004-05-09 19:21:49.000000000 +0100
820 +/* Test that -fvisibility=hidden prevents PLT. */
821 +/* { dg-do compile } */
822 +/* { dg-require-visibility "" } */
823 +/* { dg-options "-fPIC -fvisibility=hidden" } */
824 +/* { dg-final { scan-assembler-not "methodEv@PLT" } } */
832 +void Foo::method() { }
840 diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/pragma.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/pragma.C
841 --- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/pragma.C 1970-01-01 01:00:00.000000000 +0100
842 +++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/pragma.C 2004-05-09 19:18:30.000000000 +0100
844 +/* Test that #pragma GCC visibility affects class members. */
845 +/* { dg-do compile } */
846 +/* { dg-require-visibility "" } */
847 +/* { dg-final { scan-assembler "\\.hidden.*Foo.methodEv" } } */
849 +#pragma GCC visibility push(hidden)
854 +#pragma GCC visibility pop
856 +void Foo::method() { }
857 diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/pragma-override1.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/pragma-override1.C
858 --- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/pragma-override1.C 1970-01-01 01:00:00.000000000 +0100
859 +++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/pragma-override1.C 2004-05-09 19:18:36.000000000 +0100
861 +/* Test that #pragma GCC visibility does not override class member specific settings. */
862 +/* { dg-do compile } */
863 +/* { dg-require-visibility "" } */
864 +/* { dg-final { scan-assembler "\\.internal.*Foo.methodEv" } } */
866 +#pragma GCC visibility push(hidden)
867 +class __attribute__ ((visibility ("internal"))) Foo
871 +#pragma GCC visibility pop
873 +void Foo::method() { }
874 diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/pragma-override2.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/pragma-override2.C
875 --- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/pragma-override2.C 1970-01-01 01:00:00.000000000 +0100
876 +++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/pragma-override2.C 2004-05-09 19:18:44.000000000 +0100
878 +/* Test that #pragma GCC visibility does not override class member specific settings. */
879 +/* { dg-do compile } */
880 +/* { dg-require-visibility "" } */
881 +/* { dg-final { scan-assembler "\\.internal.*Foo.methodEv" } } */
883 +#pragma GCC visibility push(hidden)
886 + __attribute__ ((visibility ("internal"))) void method();
888 +#pragma GCC visibility pop
890 +void Foo::method() { }
891 diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/staticmemfuncts.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/staticmemfuncts.C
892 --- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/staticmemfuncts.C 1970-01-01 01:00:00.000000000 +0100
893 +++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/staticmemfuncts.C 2004-05-09 19:18:50.000000000 +0100
895 +/* Test that setting visibility for static class member functions works. */
896 +/* { dg-do compile } */
897 +/* { dg-require-visibility "" } */
898 +/* { dg-final { scan-assembler "\\.hidden.*Foo.methodEv" } } */
900 +class __attribute__ ((visibility ("hidden"))) Foo
902 + static void method();
905 +void Foo::method() { }
906 diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/virtual.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/virtual.C
907 --- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/virtual.C 1970-01-01 01:00:00.000000000 +0100
908 +++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/virtual.C 2004-05-09 13:24:06.000000000 +0100
910 +/* Test that setting visibility for class affects virtual table. */
911 +/* { dg-do compile } */
912 +/* { dg-require-visibility "" } */
913 +/* { dg-final { scan-assembler "\\.hidden.*ZTV3Foo" } } */
915 +class __attribute__ ((visibility ("hidden"))) Foo
917 + virtual void method();
920 +void Foo::method() { }
921 diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/visibility-1.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/visibility-1.C
922 --- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/visibility-1.C 1970-01-01 01:00:00.000000000 +0100
923 +++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/visibility-1.C 2003-12-10 06:34:44.000000000 +0000
925 +/* Test visibility attribute on function definition. */
926 +/* { dg-do compile { target *86-*-linux* } } */
927 +/* { dg-final { scan-assembler "\\.hidden.*_Z3foov" } } */
930 +__attribute__((visibility ("hidden")))
933 diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/visibility-2.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/visibility-2.C
934 --- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/visibility-2.C 1970-01-01 01:00:00.000000000 +0100
935 +++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/visibility-2.C 2003-12-10 06:34:44.000000000 +0000
937 +/* Test that visibility attribute on declaration extends to definition. */
938 +/* { dg-do compile { target *86-*-linux* } } */
939 +/* { dg-final { scan-assembler "\\.hidden.*_Z3foov" } } */
941 +void __attribute__((visibility ("hidden"))) foo();
944 diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/visibility-3.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/visibility-3.C
945 --- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/visibility-3.C 1970-01-01 01:00:00.000000000 +0100
946 +++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/visibility-3.C 2003-12-10 06:34:45.000000000 +0000
948 +/* Test visibility attribute on forward declaration of global variable */
949 +/* { dg-do compile { target *86-*-linux* } } */
950 +/* { dg-final { scan-assembler "\\.hidden.*xyzzy" } } */
953 +__attribute__((visibility ("hidden")))
955 diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/visibility-4.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/visibility-4.C
956 --- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/visibility-4.C 1970-01-01 01:00:00.000000000 +0100
957 +++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/visibility-4.C 2003-12-10 06:34:45.000000000 +0000
959 +/* Test visibility attribute on forward declaration of global variable */
960 +/* { dg-do compile { target *86-*-linux* } } */
961 +/* { dg-final { scan-assembler "\\.hidden.*xyzzy" } } */
963 +extern int __attribute__ ((visibility ("hidden")))
967 diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/visibility-5.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/visibility-5.C
968 --- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/visibility-5.C 1970-01-01 01:00:00.000000000 +0100
969 +++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/visibility-5.C 2003-12-10 06:34:45.000000000 +0000
971 +/* Test visibility attribute on definition of a function that has
972 + already had a forward declaration. */
973 +/* { dg-do compile { target *86-*-linux* } } */
974 +/* { dg-final { scan-assembler "\\.hidden.*_Z3foov" } } */
979 + __attribute__((visibility ("hidden")))
982 diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/visibility-6.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/visibility-6.C
983 --- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/visibility-6.C 1970-01-01 01:00:00.000000000 +0100
984 +++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/visibility-6.C 2003-12-10 06:34:45.000000000 +0000
986 +/* Test visibility attribute on definition of global variable that has
987 + already had a forward declaration. */
988 +/* { dg-do compile { target *86-*-linux* } } */
989 +/* { dg-final { scan-assembler "\\.hidden.*xyzzy" } } */
994 +__attribute__((visibility ("hidden")))
996 diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/visibility-7.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/visibility-7.C
997 --- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/visibility-7.C 1970-01-01 01:00:00.000000000 +0100
998 +++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/visibility-7.C 2003-12-10 06:34:45.000000000 +0000
1000 +/* Test warning from conflicting visibility specifications. */
1001 +/* { dg-do compile { target *86-*-linux* } } */
1002 +/* { dg-final { scan-assembler "\\.hidden.*xyzzy" } } */
1005 +__attribute__((visibility ("hidden")))
1006 +xyzzy; /* { dg-warning "previous declaration here" "" } */
1009 +__attribute__((visibility ("protected")))
1010 +xyzzy = 5; /* { dg-warning "visibility attribute ignored" "" } */
1011 diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility-1.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility-1.C
1012 --- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility-1.C 2003-12-10 06:34:44.000000000 +0000
1013 +++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility-1.C 1970-01-01 01:00:00.000000000 +0100
1015 -/* Test visibility attribute on function definition. */
1016 -/* { dg-do compile { target *86-*-linux* } } */
1017 -/* { dg-final { scan-assembler "\\.hidden.*_Z3foov" } } */
1020 -__attribute__((visibility ("hidden")))
1023 diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility-2.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility-2.C
1024 --- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility-2.C 2003-12-10 06:34:44.000000000 +0000
1025 +++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility-2.C 1970-01-01 01:00:00.000000000 +0100
1027 -/* Test that visibility attribute on declaration extends to definition. */
1028 -/* { dg-do compile { target *86-*-linux* } } */
1029 -/* { dg-final { scan-assembler "\\.hidden.*_Z3foov" } } */
1031 -void __attribute__((visibility ("hidden"))) foo();
1034 diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility-3.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility-3.C
1035 --- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility-3.C 2003-12-10 06:34:45.000000000 +0000
1036 +++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility-3.C 1970-01-01 01:00:00.000000000 +0100
1038 -/* Test visibility attribute on forward declaration of global variable */
1039 -/* { dg-do compile { target *86-*-linux* } } */
1040 -/* { dg-final { scan-assembler "\\.hidden.*xyzzy" } } */
1043 -__attribute__((visibility ("hidden")))
1045 diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility-4.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility-4.C
1046 --- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility-4.C 2003-12-10 06:34:45.000000000 +0000
1047 +++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility-4.C 1970-01-01 01:00:00.000000000 +0100
1049 -/* Test visibility attribute on forward declaration of global variable */
1050 -/* { dg-do compile { target *86-*-linux* } } */
1051 -/* { dg-final { scan-assembler "\\.hidden.*xyzzy" } } */
1053 -extern int __attribute__ ((visibility ("hidden")))
1057 diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility-5.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility-5.C
1058 --- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility-5.C 2003-12-10 06:34:45.000000000 +0000
1059 +++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility-5.C 1970-01-01 01:00:00.000000000 +0100
1061 -/* Test visibility attribute on definition of a function that has
1062 - already had a forward declaration. */
1063 -/* { dg-do compile { target *86-*-linux* } } */
1064 -/* { dg-final { scan-assembler "\\.hidden.*_Z3foov" } } */
1069 - __attribute__((visibility ("hidden")))
1072 diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility-6.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility-6.C
1073 --- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility-6.C 2003-12-10 06:34:45.000000000 +0000
1074 +++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility-6.C 1970-01-01 01:00:00.000000000 +0100
1076 -/* Test visibility attribute on definition of global variable that has
1077 - already had a forward declaration. */
1078 -/* { dg-do compile { target *86-*-linux* } } */
1079 -/* { dg-final { scan-assembler "\\.hidden.*xyzzy" } } */
1084 -__attribute__((visibility ("hidden")))
1086 diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility-7.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility-7.C
1087 --- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility-7.C 2003-12-10 06:34:45.000000000 +0000
1088 +++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility-7.C 1970-01-01 01:00:00.000000000 +0100
1090 -/* Test warning from conflicting visibility specifications. */
1091 -/* { dg-do compile { target *86-*-linux* } } */
1092 -/* { dg-final { scan-assembler "\\.hidden.*xyzzy" } } */
1095 -__attribute__((visibility ("hidden")))
1096 -xyzzy; /* { dg-warning "previous declaration here" "" } */
1099 -__attribute__((visibility ("protected")))
1100 -xyzzy = 5; /* { dg-warning "visibility attribute ignored" "" } */