This patch corrects an issue whereby actuals within the aspect/pragma
Linker_Section were incorrectly flagged as unreferenced causing spurious
warnings when compiling with -gnatwu. Pramga_Linker_Section is now correctly
classified within the Sig_Flags table as significant correcting this behavior.

------------
-- Source --
------------

--  constants.ads

package Constants is
   Custom_Section : constant String := ".customsection";
end Constants;

--  foo.ads

with Constants;

package Foo is
   Variable : Natural
     with Linker_Section => Constants.Custom_Section;
end Foo;

--  bar.ads

with Constants;

package Bar is
   Variable : Natural := 1
     with Linker_Section => Constants.Custom_Section;
end Bar;

----------------------------
-- Compilation and output --
----------------------------

& gnatmake -q -c -gnatwa foo.ads
& gnatmake -q -c -gnatwa bar.ads

Tested on x86_64-pc-linux-gnu, committed on trunk

2017-09-18  Justin Squirek  <squi...@adacore.com>

        * sem_prag.adb (Is_Non_Significant_Pragma_Reference): Change the
        constant indication for Pragma_Linker_Section.

Index: sem_prag.adb
===================================================================
--- sem_prag.adb        (revision 252907)
+++ sem_prag.adb        (working copy)
@@ -29548,7 +29548,7 @@
       Pragma_Linker_Constructor             => -1,
       Pragma_Linker_Destructor              => -1,
       Pragma_Linker_Options                 => -1,
-      Pragma_Linker_Section                 =>  0,
+      Pragma_Linker_Section                 => -1,
       Pragma_List                           =>  0,
       Pragma_Lock_Free                      =>  0,
       Pragma_Locking_Policy                 =>  0,

Reply via email to