utils.c (maybe_pad_type): Do not apply adjustment to original size for elementary...
authorEric Botcazou <ebotcazou@adacore.com>
Mon, 25 May 2015 21:30:39 +0000 (21:30 +0000)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Mon, 25 May 2015 21:30:39 +0000 (21:30 +0000)
* gcc-interface/utils.c (maybe_pad_type): Do not apply adjustment to
original size for elementary types before issuing the size warning.

From-SVN: r223657

gcc/ada/ChangeLog
gcc/ada/gcc-interface/utils.c
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/specs/alignment2.ads
gcc/testsuite/gnat.dg/warn11.adb [new file with mode: 0644]

index 05b1edf7bd6caa6a5e277af3afbee62e06a3b2e9..f75ecf0a37aaf5e76d8c153ad30e090f8805a896 100644 (file)
@@ -1,5 +1,15 @@
 2015-05-25  Eric Botcazou  <ebotcazou@adacore.com>
 
+       * gcc-interface/utils.c (maybe_pad_type): Do not apply adjustment to
+       original size for elementary types before issuing the size warning.
+
+2015-05-25  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * get_targ.adb (C_Get_Float_Words_BE): Adjust import name.
+       (C_Get_Words_BE): Likewise.
+       (C_Get_Bytes_BE): Likewise.
+       (C_Get_Bits_BE): Likewise.
+       (Width_From_Size): Remove superfluous space.
        * gcc-interface/targtyps.c (get_float_words_be): Rename into...
        (get_target_float_words_be): ...this.
        (get_words_be): Rename into...
index c20378ab03504201a3e53815d6ae0b2c67d64f49..291e82420ab301fb5e15a697579261f31e2f89ba 100644 (file)
@@ -1426,7 +1426,7 @@ built:
   if (CONTAINS_PLACEHOLDER_P (orig_size))
     orig_size = max_size (orig_size, true);
 
-  if (align)
+  if (align && AGGREGATE_TYPE_P (type))
     orig_size = round_up (orig_size, align);
 
   if (!operand_equal_p (size, orig_size, 0)
index 3be8bfcce72f0054b60b998a9d480d711391cb0d..aeb7308fbeba50a3813bcc1b40331e7fd0f4ceae 100644 (file)
@@ -1,3 +1,8 @@
+2015-05-25  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * gnat.dg/warn11.adb: New test.
+       * gnat.dg/specs/alignment2.ads: Add dg-warning directive.
+
 2015-05-25  Eric Botcazou  <ebotcazou@adacore.com>
 
        * gnat.dg/vfa1_1.adb: New test.
index 4adffc6f703d0b9083d6f272d4bedbeb6684946e..0b6c14f1b7d4e04f0baebe3f1ab566f2c76fe380 100644 (file)
@@ -43,7 +43,7 @@ package Alignment2 is
 
   -- OK, big size
   type I3 is new Integer_32;
-  for I3'Size use 32 * 8;
+  for I3'Size use 32 * 8; -- { dg-warning "unused" }
   for I3'Alignment use 32;
 
 end Alignment2;
diff --git a/gcc/testsuite/gnat.dg/warn11.adb b/gcc/testsuite/gnat.dg/warn11.adb
new file mode 100644 (file)
index 0000000..ff24d7c
--- /dev/null
@@ -0,0 +1,14 @@
+with Ada.Text_IO; use Ada.Text_IO;
+
+procedure Warn11 is
+
+   type My_Integer is new Integer range 1 .. 10;
+   for My_Integer'Size use 65;  -- { dg-warning "unused" }
+
+   type My_Integer2 is new Integer range 1 .. 10;
+   for My_Integer2'Size use 129;  -- { dg-warning "unused" }
+
+begin
+   Put_Line ("MB'Size is " & Natural'Image (My_Integer'Size));
+   Put_Line ("MB'Size is " & Natural'Image (My_Integer2'Size));
+end;