* 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
+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 '!
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. */
/* 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)
+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
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. */
/* 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);
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
@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.
+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
// { dg-do compile }
-// { dg-options "-Wabi" }
+// { dg-options "-Wabi -fabi-version=1" }
struct A {
virtual void f();
// { dg-do compile }
-// { dg-options "-Wabi" }
+// { dg-options "-Wabi -fabi-version=1" }
union U { // { dg-warning "ABI" }
int i: 4096; // { dg-warning "exceeds" }
// { dg-do compile }
-// { dg-options "-Wabi" }
+// { dg-options "-Wabi -fabi-version=1" }
struct A {
virtual void a ();
--- /dev/null
+// { dg-options "-fabi-version=0" }
+
+#if __GXX_ABI_VERSION != 999999
+#error "Incorrect value of __GXX_ABI_VERSION"
+#endif
--- /dev/null
+// { dg-options "-fabi-version=1" }
+
+#if __GXX_ABI_VERSION != 102
+#error "Incorrect value of __GXX_ABI_VERSION"
+#endif
--- /dev/null
+// { dg-options "-fabi-version=2" }
+
+#if __GXX_ABI_VERSION != 1002
+#error "Incorrect value of __GXX_ABI_VERSION"
+#endif
-// { dg-options "-Wabi" }
+// { dg-options "-Wabi -fabi-version=1" }
template <typename Q>
void f (typename Q::X) {}
-// { dg-options "-Wabi" }
+// { dg-options "-Wabi -fabi-version=1" }
template <template <typename> class Q>
void f (typename Q<int>::X) {}
// { dg-do compile }
-// { dg-options "-Wabi" }
+// { dg-options "-Wabi -fabi-version=1" }
struct A {
template <typename T> int f ();
-// { dg-options "-Wabi" }
+// { dg-options "-Wabi -fabi-version=1" }
enum E { e = 3 };
// { dg-do compile }
-// { dg-options "-Wabi" }
+// { dg-options "-Wabi -fabi-version=1" }
struct A { virtual void f(); char c1; };
struct B { B(); char c2; };
-// { dg-options "-Wabi" }
+// { dg-options "-Wabi -fabi-version=1" }
struct E1 {};
struct E2 : public E1 {}; // { dg-warning "layout" }
// 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
{