diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2018-09-21 10:11:37 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2018-09-21 10:11:37 +0000 |
commit | 518196cb3fce647789ff4c9f4679bb7087030158 (patch) | |
tree | 3608fccf597850b0bfea6bd4794ada2f8abe8866 | |
parent | d5d94b80c320319263b0bba3083f8bc80bf6ef4b (diff) | |
download | gcc-518196cb3fce647789ff4c9f4679bb7087030158.zip gcc-518196cb3fce647789ff4c9f4679bb7087030158.tar.gz gcc-518196cb3fce647789ff4c9f4679bb7087030158.tar.bz2 |
c-ada-spec.c: Include diagnostic.h.
* c-ada-spec.c: Include diagnostic.h.
(dump_ada_declaration) <RECORD_TYPE>: Issue a warning on packed layout.
From-SVN: r264466
-rw-r--r-- | gcc/c-family/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/c-family/c-ada-spec.c | 11 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/c-c++-common/dump-ada-spec-14.c | 10 |
4 files changed, 30 insertions, 0 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 8fc773c..4080bee 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,8 @@ +2018-09-21 Eric Botcazou <ebotcazou@adacore.com> + + * c-ada-spec.c: Include diagnostic.h. + (dump_ada_declaration) <RECORD_TYPE>: Issue a warning on packed layout. + 2018-09-19 Marek Polacek <polacek@redhat.com> * c.opt (Wclass-conversion): New. diff --git a/gcc/c-family/c-ada-spec.c b/gcc/c-family/c-ada-spec.c index 5e0dea4..eae741e 100644 --- a/gcc/c-family/c-ada-spec.c +++ b/gcc/c-family/c-ada-spec.c @@ -27,6 +27,7 @@ along with GCC; see the file COPYING3. If not see #include "c-ada-spec.h" #include "fold-const.h" #include "c-pragma.h" +#include "diagnostic.h" #include "stringpool.h" #include "attribs.h" @@ -2700,6 +2701,16 @@ dump_ada_declaration (pretty_printer *buffer, tree t, tree type, int spc) return 1; } + /* ??? Packed record layout is not supported. */ + if (TYPE_PACKED (TREE_TYPE (t))) + { + warning_at (DECL_SOURCE_LOCATION (t), 0, + "unsupported record layout"); + pp_string (buffer, "pragma Compile_Time_Warning (True, "); + pp_string (buffer, "\"probably incorrect record layout\");"); + newline_and_indent (buffer, spc); + } + if (orig && TYPE_NAME (orig)) pp_string (buffer, "subtype "); else diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b066420..6f338c2 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,9 @@ 2018-09-21 Eric Botcazou <ebotcazou@adacore.com> + * c-c++-common/dump-ada-spec-14.c: New test. + +2018-09-21 Eric Botcazou <ebotcazou@adacore.com> + * gcc.dg/nested-func-11.c: New test. * lib/target-supports.exp (check_effective_target_tls_runtime): Make diff --git a/gcc/testsuite/c-c++-common/dump-ada-spec-14.c b/gcc/testsuite/c-c++-common/dump-ada-spec-14.c new file mode 100644 index 0000000..bfdec61 --- /dev/null +++ b/gcc/testsuite/c-c++-common/dump-ada-spec-14.c @@ -0,0 +1,10 @@ +/* { dg-do compile } */ +/* { dg-options "-fdump-ada-spec" } */ + +struct __attribute__((packed)) S /* { dg-warning "unsupported record layout" } */ +{ + char c; + int t; +}; + +/* { dg-final { cleanup-ada-spec } } */ |