@@ -543,9 +543,14 @@ package body Gnatcheck.Output is
543543
544544 procedure Warning (Message : String) is
545545 begin
546- if Warning_Mode /= Quiet then
546+ if Arg.Warnings_As_Errors.Get or else Warning_Mode /= Quiet then
547547 Error (Message);
548548 end if ;
549+
550+ -- Force a non-zero return code when "warnings as errors" is enabled
551+ if Arg.Warnings_As_Errors.Get then
552+ Error_From_Warning := True;
553+ end if ;
549554 end Warning ;
550555
551556 -- --------------
@@ -593,11 +598,12 @@ package body Gnatcheck.Output is
593598 Put_Line (" --target=targetname - specify a target for cross platforms" );
594599 Put_Line (" --RTS=<runtime> - use runtime <runtime>" );
595600 Put_Line (" " );
596- Put_Line (" -h - print out the list of the available kp detectors" );
597- Put_Line (" -jn - n is the maximal number of processes" );
598- Put_Line (" -q - quiet mode (do not report detections in Stderr)" );
599- Put_Line (" -v - verbose mode" );
600- Put_Line (" -l - full pathname for file locations" );
601+ Put_Line (" -h - print out the list of the available kp detectors" );
602+ Put_Line (" -jn - n is the maximal number of processes" );
603+ Put_Line (" -q - quiet mode (do not report detections in Stderr)" );
604+ Put_Line (" -v - verbose mode" );
605+ Put_Line (" -W, --warnings-as-errors - treat warning messages as errors" );
606+ Put_Line (" -l - full pathname for file locations" );
601607 Put_Line (" " );
602608 Put_Line (" --brief - brief mode, only report detections in Stderr" );
603609 Put_Line (" --check-semantic - check semantic validity of the source files" );
@@ -636,18 +642,19 @@ package body Gnatcheck.Output is
636642 Put_Line (" --RTS=<runtime> - use runtime <runtime>" );
637643 Put_Line (" --config=<cgpr> - use configuration project <cgpr>" );
638644 Put_Line (" " );
639- Put_Line (" -h - print out the list of the currently implemented rules" );
640- Put_Line (" -mn - n is the maximal number of diagnoses in Stderr" );
641- Put_Line (" (n in 0 .. 1000, 0 means no limit); default is 0" );
642- Put_Line (" -jn - n is the maximal number of processes" );
643- Put_Line (" -q - quiet mode (do not report detections in Stderr)" );
644- Put_Line (" -t - report execution time in Stderr" );
645- Put_Line (" -v - verbose mode" );
646- Put_Line (" -l - full pathname for file locations" );
647- Put_Line (" -log - duplicate all the messages sent to Stderr in gnatcheck.log" );
648- Put_Line (" -s - short form of the report file" );
649- Put_Line (" -xml - generate report in XML format" );
650- Put_Line (" -nt - do not generate text report (enforces '-xml')" );
645+ Put_Line (" -h - print out the list of the currently implemented rules" );
646+ Put_Line (" -mn - n is the maximal number of diagnoses in Stderr" );
647+ Put_Line (" (n in 0 .. 1000, 0 means no limit); default is 0" );
648+ Put_Line (" -jn - n is the maximal number of processes" );
649+ Put_Line (" -q - quiet mode (do not report detections in Stderr)" );
650+ Put_Line (" -t - report execution time in Stderr" );
651+ Put_Line (" -v - verbose mode" );
652+ Put_Line (" -W, --warnings-as-errors - treat warning messages as errors" );
653+ Put_Line (" -l - full pathname for file locations" );
654+ Put_Line (" -log - duplicate all the messages sent to Stderr in gnatcheck.log" );
655+ Put_Line (" -s - short form of the report file" );
656+ Put_Line (" -xml - generate report in XML format" );
657+ Put_Line (" -nt - do not generate text report (enforces '-xml')" );
651658 Put_Line (" " );
652659 Put_Line (" --show-rule - append rule names to diagnoses generated" );
653660 Put_Line (" --show-instantiation-chain - show instantiation chain for reported generic construct" );
@@ -668,9 +675,9 @@ package body Gnatcheck.Output is
668675 Put_Line (" -ox filename - specify the name of the XML report file (enforces '-xml')" );
669676 Put_Line (" " );
670677 Put_Line (" filename - the name of the Ada source file to be analyzed." );
671- Put_Line (" Wildcards are allowed" );
678+ Put_Line (" Wildcards are allowed" );
672679 Put_Line (" -files=filename - the name of the text file containing a list of Ada" );
673- Put_Line (" source files to analyze" );
680+ Put_Line (" source files to analyze" );
674681 Put_Line (" --ignore=filename - do not process sources listed in filename" );
675682 Put_Line (" --rule-file=filename - read rule configuration from the given LKQL file" );
676683 Put_Line (" -r, --rule [rule_name] - enable the given rule during the GNATcheck run (this option is cumulative)" );
0 commit comments