]> gcc.gnu.org Git - gcc.git/commitdiff
c-common.c (flag_abi_version): Default to 2.
authorMark Mitchell <mark@codesourcery.com>
Tue, 23 Dec 2003 16:53:53 +0000 (16:53 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Tue, 23 Dec 2003 16:53:53 +0000 (16:53 +0000)
* c-common.c (flag_abi_version): Default to 2.
* c-cppbuiltin.c (c_cpp_builtins): Define __GXX_ABI_VERSION
uniformly for versions above 2.
* doc/invoke.texi: Update documentation for -fabi-version.

* cp-lang.c (cp_expr_size): Return zero for empty classes.

* cp-tree.h (warn_if_uknown_interface): Remove unused function.
* decl2.c (warn_if_unknown_interface): Likewise.

* g++.dg/abi/macro0.C: New test.
* g++.dg/abi/macro1.C: Likewise.
* g++.dg/abi/macro2.C: Likewise.

* g++.dg/abi/bitfield5.C: Add explicit -fabi-version=1 option.
* g++.dg/abi/bitfield7.C: Likewise.
* g++.dg/abi/dtor2.C: Likewise.
* g++.dg/abi/mangle11.C: Likewise.
* g++.dg/abi/mangle12.C: Likewise.
* g++.dg/abi/mangle14.C: Likewise.
* g++.dg/abi/mangle17.C: Likewise.
* g++.dg/abi/vbase10.C: Likewise.
* g++.dg/abi/vbase14.C: Likewise.
* g++.dg/template/qualttp17.C: Likewise.

From-SVN: r74973

22 files changed:
gcc/ChangeLog
gcc/c-common.c
gcc/c-cppbuiltin.c
gcc/cp/ChangeLog
gcc/cp/cp-lang.c
gcc/cp/cp-tree.h
gcc/cp/decl2.c
gcc/doc/invoke.texi
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/abi/bitfield5.C
gcc/testsuite/g++.dg/abi/bitfield7.C
gcc/testsuite/g++.dg/abi/dtor2.C
gcc/testsuite/g++.dg/abi/macro0.C [new file with mode: 0644]
gcc/testsuite/g++.dg/abi/macro1.C [new file with mode: 0644]
gcc/testsuite/g++.dg/abi/macro2.C [new file with mode: 0644]
gcc/testsuite/g++.dg/abi/mangle11.C
gcc/testsuite/g++.dg/abi/mangle12.C
gcc/testsuite/g++.dg/abi/mangle14.C
gcc/testsuite/g++.dg/abi/mangle17.C
gcc/testsuite/g++.dg/abi/vbase10.C
gcc/testsuite/g++.dg/abi/vbase14.C
gcc/testsuite/g++.dg/template/qualttp17.C

index 768fce9b9c3ca240fd6ce43bbe0329eb1619bf71..86135fbff0ee662e356365cb7400664adeb31338 100644 (file)
@@ -1,3 +1,10 @@
+2003-12-23  Mark Mitchell  <mark@codesourcery.com>
+
+       * c-common.c (flag_abi_version): Default to 2.
+       * c-cppbuiltin.c (c_cpp_builtins): Define __GXX_ABI_VERSION
+       uniformly for versions above 2.
+       * doc/invoke.texi: Update documentation for -fabi-version.
+
 2003-12-22  Geoffrey Keating  <geoffk@apple.com>
 
        * config/rs6000/rs6000.md: Change many instances of '!
index ce90433c85541a1828e5099dcc96775a21fa9d09..9cdd144109876b0d704a30acd5f038f8bec2d26f 100644 (file)
@@ -609,10 +609,12 @@ int flag_enforce_eh_specs = 1;
 
     1: The version of the ABI first used in G++ 3.2.
 
+    2: The version of the ABI first used in G++ 3.4.
+
     Additional positive integers will be assigned as new versions of
     the ABI become the default version of the ABI.  */
 
-int flag_abi_version = 1;
+int flag_abi_version = 2;
 
 /* Nonzero means warn about things that will change when compiling
    with an ABI-compliant compiler.  */
index 19a9cf481069d63729a646334bad1077d8dacd9a..739a34224b1e0d389d4171927e3e2474431bc01b 100644 (file)
@@ -310,7 +310,23 @@ c_cpp_builtins (cpp_reader *pfile)
 
   /* represents the C++ ABI version, always defined so it can be used while
      preprocessing C and assembler.  */
-  cpp_define (pfile, "__GXX_ABI_VERSION=102");
+  if (flag_abi_version == 0)
+    /* Use a very large value so that:
+
+         #if __GXX_ABI_VERSION >= <value for version X>
+
+       will work whether the user explicitly says "-fabi-version=x" or
+       "-fabi-version=0".  Do not use INT_MAX because that will be
+       different from system to system.  */
+    builtin_define_with_int_value ("__GXX_ABI_VERSION", 999999);
+  else if (flag_abi_version == 1)
+    /* Due to an historical accident, this version had the value
+       "102".  */
+    builtin_define_with_int_value ("__GXX_ABI_VERSION", 102);
+  else
+    /* Newer versions have values 1002, 1003, ... */
+    builtin_define_with_int_value ("__GXX_ABI_VERSION", 
+                                  1000 + flag_abi_version);
 
   /* libgcc needs to know this.  */
   if (USING_SJLJ_EXCEPTIONS)
index 69cbbed94b361d1a459c65a989d295a1ae44ac5b..9d13f3da0edc8db7bd9e75bc50c5e27960de053e 100644 (file)
@@ -1,3 +1,10 @@
+2003-12-23  Mark Mitchell  <mark@codesourcery.com>
+
+       * cp-lang.c (cp_expr_size): Return zero for empty classes.
+
+       * cp-tree.h (warn_if_uknown_interface): Remove unused function.
+       * decl2.c (warn_if_unknown_interface): Likewise.
+
 2003-12-23  Nathan Sidwell  <nathan@codesourcery.com>
 
        PR c++/13387
index 94cf4623ee8358f28209cc0644b5a707b7673446..f1f5eedcc548e75ad7d391606ea0db4eec3078dc 100644 (file)
@@ -347,7 +347,9 @@ cp_expr_size (tree exp)
        abort ();
       /* This would be wrong for a type with virtual bases, but they are
         caught by the abort above.  */
-      return CLASSTYPE_SIZE_UNIT (TREE_TYPE (exp));
+      return (is_empty_class (TREE_TYPE (exp))
+             ? size_zero_node 
+             : CLASSTYPE_SIZE_UNIT (TREE_TYPE (exp)));
     }
   else
     /* Use the default code.  */
index ba9770515d41c419030bb0cdd19489a860ca1061..91e38f48223ca4dd851852b00162ae41c3783524 100644 (file)
@@ -3710,7 +3710,6 @@ extern GTY(()) tree last_function_parms;
 /* in decl2.c */
 extern bool check_java_method (tree);
 extern int grok_method_quals (tree, tree, tree);
-extern void warn_if_unknown_interface (tree);
 extern void grok_x_components (tree);
 extern void maybe_retrofit_in_chrg (tree);
 extern void maybe_make_one_only        (tree);
index 92b661d72989bed8dfdb61158a37c735cec43688..4068826a9a9a904d9bdd60b59911e0f8abe8ad9b 100644 (file)
@@ -156,21 +156,6 @@ grok_method_quals (tree ctype, tree function, tree quals)
   return this_quals;
 }
 
-/* Warn when -fexternal-templates is used and #pragma
-   interface/implementation is not used all the times it should be,
-   inform the user.  */
-
-void
-warn_if_unknown_interface (tree decl)
-{
-  static int already_warned = 0;
-  if (already_warned++)
-    return;
-
-  cp_warning_at ("template `%#D' defined in file without #pragma interface",
-                decl);
-}
-
 /* A subroutine of the parser, to handle a component list.  */
 
 void
index 012ec04361829fb108369c985d26309fe2db66e2..db5c0b0ffdefec000f8becf1f0e75480f7591049 100644 (file)
@@ -1274,11 +1274,12 @@ Here is a list of options that are @emph{only} for compiling C++ programs:
 
 @item -fabi-version=@var{n}
 @opindex fabi-version
-Use version @var{n} of the C++ ABI.  Version 1 is the version of the C++
-ABI that first appeared in G++ 3.2.  Version 0 will always be the
-version that conforms most closely to the C++ ABI specification.
-Therefore, the ABI obtained using version 0 will change as ABI bugs are
-fixed.
+Use version @var{n} of the C++ ABI.  Version 2 is the version of the
+C++ ABI that first appeared in G++ 3.4.  Version 1 is the version of
+the C++ ABI that first appeared in G++ 3.2.  Version 0 will always be
+the version that conforms most closely to the C++ ABI specification.
+Therefore, the ABI obtained using version 0 will change as ABI bugs
+are fixed.
 
 The default is version 1.
 
index 985f9260c76972dbecc3ce15f092d62bac5c89b1..7c5ee7fa3cb9a67424adcd966a9c11c6677d558f 100644 (file)
@@ -1,3 +1,20 @@
+2003-12-23  Mark Mitchell  <mark@codesourcery.com>
+
+       * g++.dg/abi/macro0.C: New test.
+       * g++.dg/abi/macro1.C: Likewise.
+       * g++.dg/abi/macro2.C: Likewise.
+
+       * g++.dg/abi/bitfield5.C: Add explicit -fabi-version=1 option.
+       * g++.dg/abi/bitfield7.C: Likewise.
+       * g++.dg/abi/dtor2.C: Likewise.
+       * g++.dg/abi/mangle11.C: Likewise.
+       * g++.dg/abi/mangle12.C: Likewise.
+       * g++.dg/abi/mangle14.C: Likewise.
+       * g++.dg/abi/mangle17.C: Likewise.
+       * g++.dg/abi/vbase10.C: Likewise.
+       * g++.dg/abi/vbase14.C: Likewise.
+       * g++.dg/template/qualttp17.C: Likewise.
+
 2003-12-21  Andrew Pinski  <pinskia@physics.uc.edu>
 
        PR c/11995
index eed76e649e6e4cd3b63f9b7df69a08232b0caa58..e754f0ddf224bd6d8c27b6802c53df3db23727d2 100644 (file)
@@ -1,5 +1,5 @@
 // { dg-do compile } 
-// { dg-options "-Wabi" }
+// { dg-options "-Wabi -fabi-version=1" }
 
 struct A { 
   virtual void f(); 
index 9868cfce1987584ce0bc4fde27d8df208969c46e..b5b656ffa477b200798865c7f22cbe0f2b58edf0 100644 (file)
@@ -1,5 +1,5 @@
 // { dg-do compile }
-// { dg-options "-Wabi" }
+// { dg-options "-Wabi -fabi-version=1" }
 
 union U { // { dg-warning "ABI" }
   int i: 4096; // { dg-warning "exceeds" }
index f4a1336fefa4052fcbce16e3227ec5eafe7855f1..6b89cc8eae0582f9c87bc79cbdfdb05b6de7f61a 100644 (file)
@@ -1,5 +1,5 @@
 // { dg-do compile }
-// { dg-options "-Wabi" }
+// { dg-options "-Wabi -fabi-version=1" }
 
 struct A {
   virtual void a ();
diff --git a/gcc/testsuite/g++.dg/abi/macro0.C b/gcc/testsuite/g++.dg/abi/macro0.C
new file mode 100644 (file)
index 0000000..6c391e6
--- /dev/null
@@ -0,0 +1,5 @@
+// { dg-options "-fabi-version=0" }
+
+#if __GXX_ABI_VERSION != 999999
+#error "Incorrect value of __GXX_ABI_VERSION"
+#endif
diff --git a/gcc/testsuite/g++.dg/abi/macro1.C b/gcc/testsuite/g++.dg/abi/macro1.C
new file mode 100644 (file)
index 0000000..871208d
--- /dev/null
@@ -0,0 +1,5 @@
+// { dg-options "-fabi-version=1" }
+
+#if __GXX_ABI_VERSION != 102
+#error "Incorrect value of __GXX_ABI_VERSION"
+#endif
diff --git a/gcc/testsuite/g++.dg/abi/macro2.C b/gcc/testsuite/g++.dg/abi/macro2.C
new file mode 100644 (file)
index 0000000..9f0af9c
--- /dev/null
@@ -0,0 +1,5 @@
+// { dg-options "-fabi-version=2" }
+
+#if __GXX_ABI_VERSION != 1002
+#error "Incorrect value of __GXX_ABI_VERSION"
+#endif
index f7151171d30668ed8a31defd83cef234cb8d86fc..a049a9566713e25a1b67bd422b431c9fa0a988bd 100644 (file)
@@ -1,4 +1,4 @@
-// { dg-options "-Wabi" }
+// { dg-options "-Wabi -fabi-version=1" }
 
 template <typename Q>
 void f (typename Q::X) {}
index 772b58b7a39e6115420ecbbb13869ffcddae04fa..406a13b3f79f44ff6d9588738122f0ac92fc4ac7 100644 (file)
@@ -1,4 +1,4 @@
-// { dg-options "-Wabi" }
+// { dg-options "-Wabi -fabi-version=1" }
 
 template <template <typename> class Q>
 void f (typename Q<int>::X) {}
index 8e2bfddde76aeba857f0b6232d0fbd59ad88ba9f..1205ac45fe0a9323a8f5906653cc0218b43921a6 100644 (file)
@@ -1,5 +1,5 @@
 // { dg-do compile }
-// { dg-options "-Wabi" }
+// { dg-options "-Wabi -fabi-version=1" }
 
 struct A {
   template <typename T> int f ();
index 6f8e387e1d7ecef648c4b16e2360db2dbb2bad80..994da88edcaa36c9adbba6c562a9ee380856b0a6 100644 (file)
@@ -1,4 +1,4 @@
-// { dg-options "-Wabi" }
+// { dg-options "-Wabi -fabi-version=1" }
 
 enum E { e = 3 };
 
index 3c110be71885f32b5a46ba5c626f05ecec240ca3..7683250ea5d48e59cc3868a2102f1769e3d671b8 100644 (file)
@@ -1,5 +1,5 @@
 // { dg-do compile }
-// { dg-options "-Wabi" }
+// { dg-options "-Wabi -fabi-version=1" }
 
 struct A { virtual void f(); char c1; };
 struct B { B(); char c2; };
index 99290b857209f0dea75a2bd874b5f8b171c68444..320d5ba77dcb3843726e3d37069520c1d9f2d5ab 100644 (file)
@@ -1,4 +1,4 @@
-// { dg-options "-Wabi" }
+// { dg-options "-Wabi -fabi-version=1" }
 
 struct E1 {};
 struct E2 : public E1 {}; // { dg-warning "layout" }
index 4766c53847d5d4b90f90af0f4a088ec8be78ffb6..4d79c9a7653f3cef4d367aca57328bc2756da2f7 100644 (file)
@@ -1,7 +1,7 @@
 // Copyright (C) 2001 Free Software Foundation
 // Contributed by Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
 // { dg-do compile }
-// { dg-options "-fno-inline" }
+// { dg-options "-fno-inline -fabi-version=1" }
 
 struct A
 {
This page took 0.124585 seconds and 5 git commands to generate.