summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/c-cppbuiltin.c2
-rw-r--r--gcc/doc/cpp.texi20
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/g++.dg/cpp/weak.C5
5 files changed, 36 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 6ba6bb8b5e6..4f48773d438 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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.
diff --git a/gcc/c-cppbuiltin.c b/gcc/c-cppbuiltin.c
index 06904dbb5e5..bb656f46b05 100644
--- a/gcc/c-cppbuiltin.c
+++ b/gcc/c-cppbuiltin.c
@@ -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");
diff --git a/gcc/doc/cpp.texi b/gcc/doc/cpp.texi
index 02cb4b8d200..71bd4ee2677 100644
--- a/gcc/doc/cpp.texi
+++ b/gcc/doc/cpp.texi
@@ -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
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index f1c04ecedd5..33dca447a1e 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
index 00000000000..6c51e1985aa
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp/weak.C
@@ -0,0 +1,5 @@
+// { dg-options "-fno-weak" }
+
+#if __GXX_WEAK__
+#error "__GXX_WEAK__ defined when -fno-weak in use"
+#endif