summaryrefslogtreecommitdiffstats
path: root/contrib/gcc/cp
diff options
context:
space:
mode:
authorpfg <pfg@FreeBSD.org>2013-11-29 18:46:02 +0000
committerpfg <pfg@FreeBSD.org>2013-11-29 18:46:02 +0000
commit412075b2311a065af8a572ca368fe2006de9bcac (patch)
tree16aa550f2d0b9c92a10cd8ebe3e804bcc566d5e0 /contrib/gcc/cp
parent430acb421726ab31ef1ff326a7c992c59ff2ec65 (diff)
downloadFreeBSD-src-412075b2311a065af8a572ca368fe2006de9bcac.zip
FreeBSD-src-412075b2311a065af8a572ca368fe2006de9bcac.tar.gz
gcc: upstream alignment cleanups.
This solves GCC/32617 and contributes to reduce differences with Apple's gcc42. Complete some references in the ChangeLog while here. Obtained from: gcc 4.3 (rev. 126529, 126588; GPLv2) MFC after: 3 weeks
Diffstat (limited to 'contrib/gcc/cp')
-rw-r--r--contrib/gcc/cp/ChangeLog.gcc439
-rw-r--r--contrib/gcc/cp/decl.c14
-rw-r--r--contrib/gcc/cp/typeck.c5
3 files changed, 21 insertions, 7 deletions
diff --git a/contrib/gcc/cp/ChangeLog.gcc43 b/contrib/gcc/cp/ChangeLog.gcc43
index e232596..b95ac58 100644
--- a/contrib/gcc/cp/ChangeLog.gcc43
+++ b/contrib/gcc/cp/ChangeLog.gcc43
@@ -1,3 +1,12 @@
+2007-07-09 Geoffrey Keating <geoffk@apple.com>
+
+ PR 32617
+ * decl.c (cxx_init_decl_processing): Don't set
+ force_align_functions_log.
+ (grokfndecl): Honour ptrmemfunc_vbit_in_pfn.
+ * typeck.c (cxx_alignof_expr): When alignof is used on a plain
+ FUNCTION_DECL, return its alignment.
+
2007-06-28 Geoffrey Keating <geoffk@apple.com> (r126080)
* decl2.c (start_objects): Mark constructor-runnning function
diff --git a/contrib/gcc/cp/decl.c b/contrib/gcc/cp/decl.c
index c35f74a..58128aa 100644
--- a/contrib/gcc/cp/decl.c
+++ b/contrib/gcc/cp/decl.c
@@ -3158,12 +3158,6 @@ cxx_init_decl_processing (void)
if (flag_inline_functions)
flag_inline_trees = 2;
- /* Force minimum function alignment if using the least significant
- bit of function pointers to store the virtual bit. */
- if (TARGET_PTRMEMFUNC_VBIT_LOCATION == ptrmemfunc_vbit_in_pfn
- && force_align_functions_log < 1)
- force_align_functions_log = 1;
-
/* Initially, C. */
current_lang_name = lang_name_c;
@@ -6065,6 +6059,14 @@ grokfndecl (tree ctype,
if (TYPE_VOLATILE (type))
TREE_THIS_VOLATILE (decl) = 1;
+ /* If pointers to member functions use the least significant bit to
+ indicate whether a function is virtual, ensure a pointer
+ to this function will have that bit clear. */
+ if (TARGET_PTRMEMFUNC_VBIT_LOCATION == ptrmemfunc_vbit_in_pfn
+ && TREE_CODE (type) == METHOD_TYPE
+ && DECL_ALIGN (decl) < 2 * BITS_PER_UNIT)
+ DECL_ALIGN (decl) = 2 * BITS_PER_UNIT;
+
if (friendp
&& TREE_CODE (orig_declarator) == TEMPLATE_ID_EXPR)
{
diff --git a/contrib/gcc/cp/typeck.c b/contrib/gcc/cp/typeck.c
index d17d0bb..5325989 100644
--- a/contrib/gcc/cp/typeck.c
+++ b/contrib/gcc/cp/typeck.c
@@ -1358,7 +1358,10 @@ cxx_alignof_expr (tree e)
{
pedwarn ("ISO C++ forbids applying %<__alignof%> to an expression of "
"function type");
- t = size_one_node;
+ if (TREE_CODE (e) == FUNCTION_DECL)
+ t = size_int (DECL_ALIGN_UNIT (e));
+ else
+ t = size_one_node;
}
else if (type_unknown_p (e))
{
OpenPOWER on IntegriCloud