aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/opt.ads
diff options
context:
space:
mode:
authorBob Duff <duff@adacore.com>2019-08-20 09:48:51 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2019-08-20 09:48:51 +0000
commit6cd8f5b09415ec799f797e5b521afd18552cd747 (patch)
tree73b01db9d46ba069cf32333cb74682a3952538c6 /gcc/ada/opt.ads
parent98cbc7e489ced8092e110777c119751f245ad116 (diff)
downloadgcc-6cd8f5b09415ec799f797e5b521afd18552cd747.zip
gcc-6cd8f5b09415ec799f797e5b521afd18552cd747.tar.gz
gcc-6cd8f5b09415ec799f797e5b521afd18552cd747.tar.bz2
[Ada] Pragma Warning_As_Error works for style warnings
Pragma Warning_As_Error now works for style warnings (messages that start with "(style)", enabled by -gnaty) the same way it works for regular warnings enabled by -gnatw. The following test should fail to build with style checks: gnat.adc: pragma Warning_As_Error ("two spaces required"); style.adb: procedure Style is X : Integer; begin null; --Hello end; gnatmake -q -f -g style.adb -gnaty should get: style.adb:2:04: warning: variable "X" is never read and never assigned style.adb:5:06: error: (style) two spaces required [warning-as-error] style.adb:6:01: (style) "end Style" required gnatmake: "style.adb" compilation error and no executable should be created. 2019-08-20 Bob Duff <duff@adacore.com> gcc/ada/ * errout.adb (Error_Msg_Internal): Set Warn_Err in case of Is_Style_Msg. * erroutc.adb (Output_Msg_Text): Do Warnings_Treated_As_Errors processing and [warning-as-error] modification for style messages. Clean up code, simplify, remove unnecessary block statement, add renaming of table entry. * erroutc.ads (Warning_Treated_As_Error): Fix comment: no such thing as Set_Warning_As_Error. * opt.ads: Clean up comments and move related declarations near each other. * par-prag.adb: Process Warning_As_Error. This is necessary because many style warning happen during parsing. * sem_prag.adb: Use new Acquire_Warning_Match_String. * sem_util.ads, sem_util.adb (Acquire_Warning_Match_String): New function shared by par-prag.adb and sem_prag.adb. Replaces the procedure in sem_prag.adb. Avoid use of global variables. * stringt.ads, stringt.adb (To_String): New function to convert String_Id to String. * doc/gnat_rm/implementation_defined_pragmas.rst: Document the new feature. * gnat_rm.texi: Regenerate. From-SVN: r274721
Diffstat (limited to 'gcc/ada/opt.ads')
-rw-r--r--gcc/ada/opt.ads28
1 files changed, 14 insertions, 14 deletions
diff --git a/gcc/ada/opt.ads b/gcc/ada/opt.ads
index 3158899..d3cba61 100644
--- a/gcc/ada/opt.ads
+++ b/gcc/ada/opt.ads
@@ -1944,10 +1944,6 @@ package Opt is
-- which requires pragma Warnings to be stored for the formal verification
-- backend.
- Warnings_As_Errors_Count : Natural;
- -- GNAT
- -- Number of entries stored in Warnings_As_Errors table
-
Wide_Character_Encoding_Method : WC_Encoding_Method := WCEM_Brackets;
-- GNAT, GNATBIND
-- Method used for encoding wide characters in the source program. See
@@ -2158,10 +2154,6 @@ package Opt is
-- is ignored for internal and predefined units (which are always compiled
-- with the standard Size semantics).
- Warnings_As_Errors_Count_Config : Natural;
- -- GNAT
- -- Count of pattern strings stored from Warning_As_Error pragmas
-
type Config_Switches_Type is private;
-- Type used to save values of the switches set from Config values
@@ -2268,16 +2260,24 @@ package Opt is
---------------------------
-- The following array would more reasonably be located in Err_Vars or
- -- Errour, but we put them here to deal with licensing issues (we need
+ -- Errout, but we put them here to deal with licensing issues (we need
-- this to have the GPL exception licensing, since these variables and
-- subprograms are accessed from units with this licensing).
Warnings_As_Errors : array (1 .. 10_000) of String_Ptr;
- -- Table for recording Warning_As_Error pragmas as they are processed.
- -- It would be nicer to use Table, but there are circular elaboration
- -- problems if we try to do this, and an attempt to find some other
- -- appropriately licensed unit to declare this as a Table failed with
- -- various elaboration circularities. Memory is getting cheap these days!
+ -- Table for recording Warning_As_Error pragmas as they are processed. It
+ -- would be nicer to use Table, but there are circular elaboration problems
+ -- if we try to do this, and an attempt to find some other appropriately
+ -- licensed unit to declare this as a Table failed with various elaboration
+ -- circularities.
+
+ Warnings_As_Errors_Count : Natural;
+ -- GNAT
+ -- Number of entries stored in Warnings_As_Errors table
+
+ Warnings_As_Errors_Count_Config : Natural;
+ -- GNAT
+ -- Count of pattern strings stored from Warning_As_Error pragmas
---------------
-- GNAT_Mode --