Hi,
this plugs the hole reported by Florian on the gcc@ list, namely that no
warning is issued with -Wall in C++ on pragma scalar_storage_order.
Tested on x86_64-suse-linux, OK for the mainline? And some branches?
2017-09-15 Eric Botcazou <ebotca...@adacore.com>
* c-pragma.c (handle_pragma_scalar_storage_order): Expand on error
message for non-uniform endianness and issue a warning in C++.
2017-09-15 Eric Botcazou <ebotca...@adacore.com>
* g++.dg/sso-1.C: New test.
* g++.dg/sso-2.C: Likewise.
--
Eric Botcazou
Index: c-family/c-pragma.c
===================================================================
--- c-family/c-pragma.c (revision 252749)
+++ c-family/c-pragma.c (working copy)
@@ -415,7 +415,19 @@ handle_pragma_scalar_storage_order (cpp_
tree x;
if (BYTES_BIG_ENDIAN != WORDS_BIG_ENDIAN)
- error ("scalar_storage_order is not supported");
+ {
+ error ("scalar_storage_order is not supported because endianness "
+ "is not uniform");
+ return;
+ }
+
+ if (c_dialect_cxx ())
+ {
+ if (warn_unknown_pragmas > in_system_header_at (input_location))
+ warning (OPT_Wunknown_pragmas,
+ "%<#pragma scalar_storage_order%> is not supported for C++");
+ return;
+ }
token = pragma_lex (&x);
if (token != CPP_NAME)
/* Test support of scalar_storage_order attribute */
/* { dg-do compile } */
struct __attribute__((scalar_storage_order("little-endian"))) Rec /* { dg-warning "attribute ignored" } */
{
int i;
};
/* Test support of scalar_storage_order pragma */
/* { dg-do compile } */
/* { dg-options "-Wall" } */
#pragma scalar_storage_order little-endian /* { dg-warning "not supported" } */