]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
c-cppbuiltin.c (c_cpp_builtins): Do not define __GXX_WEAK__ to 1 if !flag_weak.
authorMark Mitchell <mark@codesourcery.com>
Sun, 1 May 2005 20:30:40 +0000 (20:30 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Sun, 1 May 2005 20:30:40 +0000 (20:30 +0000)
* c-cppbuiltin.c (c_cpp_builtins): Do not define __GXX_WEAK__ to 1
if !flag_weak.
* doc/cpp.texi (__DEPRECATED): Document.
(__EXCEPTIONS): Likewise.
(__GXX_WEAK__): Likewise.

* g++.dg/cpp/weak.C: New test.

From-SVN: r99080

gcc/ChangeLog
gcc/c-cppbuiltin.c
gcc/doc/cpp.texi
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp/weak.C [new file with mode: 0644]

index 6ba6bb8b5e6c8f580d41769c1eef80ff09272707..4f48773d438bfedd1c37cb627f3bfd4801bf4f60 100644 (file)
@@ -1,5 +1,11 @@
 2005-05-01  Mark Mitchell  <mark@codesourcery.com>
 
+       * c-cppbuiltin.c (c_cpp_builtins): Do not define __GXX_WEAK__ to 1
+       if !flag_weak.
+       * doc/cpp.texi (__DEPRECATED): Document.
+       (__EXCEPTIONS): Likewise.
+       (__GXX_WEAK__): Likewise.
+
        * function.c (INVOKE__main): Do not define.
        (expand_main_function): Check HAS_INIT_SECTION when determining
        whether or not to call __main.
index 06904dbb5e52b7f896e8aa975221503bbf1bafda..bb656f46b0504bc7d5d5435fc50e7e12dec3aca7 100644 (file)
@@ -328,7 +328,7 @@ c_cpp_builtins (cpp_reader *pfile)
 
   if (c_dialect_cxx ())
     {
-      if (SUPPORTS_ONE_ONLY)
+      if (flag_weak && SUPPORTS_ONE_ONLY) 
        cpp_define (pfile, "__GXX_WEAK__=1");
       else
        cpp_define (pfile, "__GXX_WEAK__=0");
index 02cb4b8d2004ca06f4ec2586e5f1afad5e715931..71bd4ee26772d5d9cc65d72caa4fbd61c501550a 100644 (file)
@@ -2081,11 +2081,31 @@ respectively.  They exist to make the standard header given numerical limits
 work correctly.  You should not use these macros directly; instead, include
 the appropriate headers.
 
+@item __DEPRECATED
+This macro is defined, with value 1, when compiling a C++ source file
+with warnings about deprecated constructs enabled.  These warnings are
+enabled by default, but can be disabled with @option{-Wno-deprecated}.
+
+@item __EXCEPTIONS
+This macro is defined, with value 1, when compiling a C++ source file
+with exceptions enabled.  If @option{-fno-exceptions} was used when
+compiling the file, then this macro will not be defined.
+
 @item __USING_SJLJ_EXCEPTIONS__
 This macro is defined, with value 1, if the compiler uses the old
 mechanism based on @code{setjmp} and @code{longjmp} for exception
 handling.
 
+@item __GXX_WEAK__
+This macro is defined when compiling a C++ source file.  It has the
+value 1 if the compiler will use weak symbols, COMDAT sections, or
+other similar techniques to collapse symbols with ``vague linkage''
+that are defined in multiple translation units.  If the compiler will
+not collapse such symbols, this macro is defined with value 0.  In
+general, user code should not need to make use of this macro; the
+purpose of this macro is to ease implementation of the C++ runtime
+library provided with G++.
+
 @item __NEXT_RUNTIME__
 This macro is defined, with value 1, if (and only if) the NeXT runtime
 (as in @option{-fnext-runtime}) is in use for Objective-C@.  If the GNU
index f1c04ecedd5784fd1f80970fff12a15d1b0b5500..33dca447a1eb2bb359b32af1c533558f6154998f 100644 (file)
@@ -1,3 +1,7 @@
+2005-05-01  Mark Mitchell  <mark@codesourcery.com>
+
+       * g++.dg/cpp/weak.C: New test.
+
 2005-05-01  Zdenek Dvorak  <dvorakz@suse.cz>
 
        * gcc.dg/tree-ssa/loop-8.c: New test.
diff --git a/gcc/testsuite/g++.dg/cpp/weak.C b/gcc/testsuite/g++.dg/cpp/weak.C
new file mode 100644 (file)
index 0000000..6c51e19
--- /dev/null
@@ -0,0 +1,5 @@
+// { dg-options "-fno-weak" }
+
+#if __GXX_WEAK__
+#error "__GXX_WEAK__ defined when -fno-weak in use"
+#endif