summaryrefslogtreecommitdiff
path: root/gcc/c/c-parser.c
diff options
context:
space:
mode:
authorjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>2013-12-04 22:57:20 +0000
committerjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>2013-12-04 22:57:20 +0000
commita179a7dc6da7e4e841f961291b2417853736071d (patch)
tree1d857f76a0338447e2abb6b4d8b9d3a69458fff2 /gcc/c/c-parser.c
parent137559b2325c900743803d115c4d8495f9da5d67 (diff)
downloadgcc-a179a7dc6da7e4e841f961291b2417853736071d.tar.gz
PR c/52023
c-family: * c-common.c (c_sizeof_or_alignof_type): Add parameter min_alignof and check field alignment if set. * c-common.h (c_sizeof_or_alignof_type): Update prototype. (c_sizeof, c_alignof): Update calls to c_sizeof_or_alignof_type. c: * c-parser.c (c_parser_alignas_specifier): Use c_sizeof_or_alignof_type instead of c_alignof. (c_parser_alignof_expression): Likewise, with min_alignof parameter depending on alignof spelling used. cp: * typeck.c (cxx_sizeof_or_alignof_type): Update call to c_sizeof_or_alignof_type. objc: * objc-act.c (objc_synthesize_getter): Update calls to c_sizeof_or_alignof_type. testsuite: * gcc.dg/c11-align-6.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@205685 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c/c-parser.c')
-rw-r--r--gcc/c/c-parser.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c
index 141c4ce9cf6..c78d26909b4 100644
--- a/gcc/c/c-parser.c
+++ b/gcc/c/c-parser.c
@@ -3045,7 +3045,8 @@ c_parser_alignas_specifier (c_parser * parser)
{
struct c_type_name *type = c_parser_type_name (parser);
if (type != NULL)
- ret = c_alignof (loc, groktypename (type, NULL, NULL));
+ ret = c_sizeof_or_alignof_type (loc, groktypename (type, NULL, NULL),
+ false, true, 1);
}
else
ret = c_parser_expr_no_commas (parser, NULL).value;
@@ -6446,11 +6447,12 @@ c_parser_alignof_expression (c_parser *parser)
location_t loc = c_parser_peek_token (parser)->location;
tree alignof_spelling = c_parser_peek_token (parser)->value;
gcc_assert (c_parser_next_token_is_keyword (parser, RID_ALIGNOF));
+ bool is_c11_alignof = strcmp (IDENTIFIER_POINTER (alignof_spelling),
+ "_Alignof") == 0;
/* A diagnostic is not required for the use of this identifier in
the implementation namespace; only diagnose it for the C11
spelling because of existing code using the other spellings. */
- if (!flag_isoc11
- && strcmp (IDENTIFIER_POINTER (alignof_spelling), "_Alignof") == 0)
+ if (!flag_isoc11 && is_c11_alignof)
{
if (flag_isoc99)
pedwarn (loc, OPT_Wpedantic, "ISO C99 does not support %qE",
@@ -6494,7 +6496,9 @@ c_parser_alignof_expression (c_parser *parser)
/* alignof ( type-name ). */
c_inhibit_evaluation_warnings--;
in_alignof--;
- ret.value = c_alignof (loc, groktypename (type_name, NULL, NULL));
+ ret.value = c_sizeof_or_alignof_type (loc, groktypename (type_name,
+ NULL, NULL),
+ false, is_c11_alignof, 1);
ret.original_code = ERROR_MARK;
ret.original_type = NULL;
return ret;