@@ -202,13 +202,10 @@ package body Gnatcheck.Output is
202202 -- Info --
203203 -- --------
204204
205- procedure Info
206- (Message : String;
207- Line_Len : Natural := 0 ;
208- Spacing : Natural := 0 ) is
205+ procedure Info (Message : String) is
209206 begin
210- Info_No_EOL (Message, Line_Len, Spacing );
211- New_Line (Current_Error );
207+ Info_No_EOL (Message);
208+ New_Line (Standard_Error );
212209
213210 if Log_Mode and then Is_Open (Log_File) then
214211 New_Line (Log_File);
@@ -219,87 +216,12 @@ package body Gnatcheck.Output is
219216 -- Info_No_EOL --
220217 -- ---------------
221218
222- procedure Info_No_EOL
223- (Message : String;
224- Line_Len : Natural := 0 ;
225- Spacing : Natural := 0 )
226- is
227- Start_Idx : constant Natural := Message'First;
228- End_Idx : Natural := Message'Last;
229- Start_From : Positive;
230-
219+ procedure Info_No_EOL (Message : String) is
231220 begin
232- if Line_Len = 0
233- or else
234- End_Idx - Start_Idx + 1 <= Line_Len
235- then
236- Put (Current_Error, Message);
237-
238- if Log_Mode and then Is_Open (Log_File) then
239- Put (Log_File, Message);
240- end if ;
241-
242- else
243- -- Define which part of the Message can be placed into one line:
244- while End_Idx >= Start_Idx
245- and then
246- not (Message (End_Idx) = ' '
247- and then
248- End_Idx - Start_Idx + 1 <= Line_Len)
249- loop
250- End_Idx := End_Idx - 1 ;
251- end loop ;
252-
253- if End_Idx < Start_Idx then
254- -- Cannot split Message, so:
255- Put (Current_Error, Message);
256-
257- if Log_Mode and then Is_Open (Log_File) then
258- Put (Log_File, Message);
259- end if ;
221+ Put (Standard_Error, Message);
260222
261- else
262- -- Index of the beginning of the remaining part of Message
263- Start_From := End_Idx + 1 ;
264-
265- -- Now move End_Idx to the left to skip spaces:
266-
267- while End_Idx >= Start_Idx
268- and then
269- Message (End_Idx) = ' '
270- loop
271- End_Idx := End_Idx - 1 ;
272- end loop ;
273-
274- Put (Current_Error, Message (Start_Idx .. End_Idx));
275-
276- if Log_Mode and then Is_Open (Log_File) then
277- Put (Log_File, Message (Start_Idx .. End_Idx));
278- end if ;
279-
280- -- Skip spaces in the remaining part of the message, if any:
281- End_Idx := Message'Last;
282-
283- while Start_From <= End_Idx
284- and then
285- Message (Start_From) = ' '
286- loop
287- Start_From := Start_From + 1 ;
288- end loop ;
289-
290- if Start_From <= End_Idx then
291- New_Line (Current_Error);
292-
293- if Log_Mode and then Is_Open (Log_File) then
294- New_Line (Log_File);
295- end if ;
296-
297- Info_No_EOL
298- (Message => Spacing * ' ' & Message (Start_From .. End_Idx),
299- Line_Len => Line_Len,
300- Spacing => Spacing);
301- end if ;
302- end if ;
223+ if Log_Mode and then Is_Open (Log_File) then
224+ Put (Log_File, Message);
303225 end if ;
304226 end Info_No_EOL ;
305227
@@ -653,117 +575,117 @@ package body Gnatcheck.Output is
653575 pragma Style_Checks (" M200" ); -- Allow long lines
654576
655577 if Gnatkp_Mode then
656- Info (" gnatkp: the GNAT known problem detector" );
657- Info (" usage: gnatkp -Pproject [options] [-rules [-from=file] {+Rkp_id[:param]}]" );
658- Info (" options:" );
659- Info (" --version - Display version and exit" );
660- Info (" --help - Display usage and exit" );
661- Info (" " );
662- Info (" -Pproject - Use project file project. Only one such switch can be used" );
663- Info (" -U - check all sources of the argument project" );
664- Info (" -U main - check the closure of units rooted at unit main" );
665- Info (" --no-subprojects - process only sources of root project" );
666- Info (" -Xname=value - specify an external reference for argument project file" );
667- Info (" --subdirs=dir - specify subdirectory to place the result files into" );
668- Info (" -eL - follow all symbolic links when processing project files" );
669- Info (" -o filename - specify the name of the report file" );
670- Info (" " );
671- Info (" --target=targetname - specify a target for cross platforms" );
672- Info (" --RTS=<runtime> - use runtime <runtime>" );
673- Info (" " );
674- Info (" -h - print out the list of the available kp detectors" );
675- Info (" -jn - n is the maximal number of processes" );
676- Info (" -q - quiet mode (do not report detections in Stderr)" );
677- Info (" -v - verbose mode" );
678- Info (" -l - full pathname for file locations" );
679- Info (" " );
680- Info (" --brief - brief mode, only report detections in Stderr" );
681- Info (" --check-semantic - check semantic validity of the source files" );
682- Info (" --charset=<charset> - specify the charset of the source files" );
683- Info (" --kp-version=<version> - enable all KP detectors matching GNAT <version>" );
684- Info (" --rule-file=filename - read kp configuration from the given LKQL file" );
685- Info (" -r, --rule [kp_id] - enable the given kp detector during the GNATKP run (this option is cumulative)" );
686- Info (" " );
687- Info (" -from=filename - read kp options from filename" );
688- Info (" +R<kp_id>[:param] - turn ON a given detector [with given parameter]" );
689- Info (" where <kp_id> - ID of one of the currently implemented" );
690- Info (" detectors, use '-h' for the full list" );
691- Info (" " );
692- Info (" KP detectors must be specified either implicitly via --kp-version " );
693- Info (" (and optionally --target), or explicitly via -rules" );
578+ Put_Line (" gnatkp: the GNAT known problem detector" );
579+ Put_Line (" usage: gnatkp -Pproject [options] [-rules [-from=file] {+Rkp_id[:param]}]" );
580+ Put_Line (" options:" );
581+ Put_Line (" --version - Display version and exit" );
582+ Put_Line (" --help - Display usage and exit" );
583+ Put_Line (" " );
584+ Put_Line (" -Pproject - Use project file project. Only one such switch can be used" );
585+ Put_Line (" -U - check all sources of the argument project" );
586+ Put_Line (" -U main - check the closure of units rooted at unit main" );
587+ Put_Line (" --no-subprojects - process only sources of root project" );
588+ Put_Line (" -Xname=value - specify an external reference for argument project file" );
589+ Put_Line (" --subdirs=dir - specify subdirectory to place the result files into" );
590+ Put_Line (" -eL - follow all symbolic links when processing project files" );
591+ Put_Line (" -o filename - specify the name of the report file" );
592+ Put_Line (" " );
593+ Put_Line (" --target=targetname - specify a target for cross platforms" );
594+ Put_Line (" --RTS=<runtime> - use runtime <runtime>" );
595+ 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 (" " );
602+ Put_Line (" --brief - brief mode, only report detections in Stderr" );
603+ Put_Line (" --check-semantic - check semantic validity of the source files" );
604+ Put_Line (" --charset=<charset> - specify the charset of the source files" );
605+ Put_Line (" --kp-version=<version> - enable all KP detectors matching GNAT <version>" );
606+ Put_Line (" --rule-file=filename - read kp configuration from the given LKQL file" );
607+ Put_Line (" -r, --rule [kp_id] - enable the given kp detector during the GNATKP run (this option is cumulative)" );
608+ Put_Line (" " );
609+ Put_Line (" -from=filename - read kp options from filename" );
610+ Put_Line (" +R<kp_id>[:param] - turn ON a given detector [with given parameter]" );
611+ Put_Line (" where <kp_id> - ID of one of the currently implemented" );
612+ Put_Line (" detectors, use '-h' for the full list" );
613+ Put_Line (" " );
614+ Put_Line (" KP detectors must be specified either implicitly via --kp-version " );
615+ Put_Line (" (and optionally --target), or explicitly via -rules" );
694616 return ;
695617 end if ;
696618
697- Info (" gnatcheck: the GNAT rule checking tool" );
698- Info (" usage: gnatcheck [options] {filename} {-files=filename} -rules rule_switches [-cargs gcc_switches]" );
699- Info (" options:" );
700- Info (" --version - Display version and exit" );
701- Info (" --help - Display usage and exit" );
702- Info (" " );
703- Info (" -Pproject - Use project file project. Only one such switch can be used" );
704- Info (" -U - check all sources of the argument project" );
705- Info (" -U main - check the closure of units rooted at unit main" );
706- Info (" --no-subprojects - process only sources of root project" );
707- Info (" -Xname=value - specify an external reference for argument project file" );
708- Info (" --subdirs=dir - specify subdirectory to place the result files into" );
709- Info (" --no_objects_dir - place results into current dir instead of project dir" );
710- Info (" -eL - follow all symbolic links when processing project files" );
711- Info (" " );
712- Info (" --ignore-project-switches - ignore switches specified in the project file" );
713- Info (" --target=targetname - specify a target for cross platforms" );
714- Info (" --RTS=<runtime> - use runtime <runtime>" );
715- Info (" --config=<cgpr> - use configuration project <cgpr>" );
716- Info (" " );
717- Info (" -h - print out the list of the currently implemented rules" );
718- Info (" -mn - n is the maximal number of diagnoses in Stderr" );
719- Info (" (n in 0 .. 1000, 0 means no limit); default is 0" );
720- Info (" -jn - n is the maximal number of processes" );
721- Info (" -q - quiet mode (do not report detections in Stderr)" );
722- Info (" -t - report execution time in Stderr" );
723- Info (" -v - verbose mode" );
724- Info (" -l - full pathname for file locations" );
725- Info (" -log - duplicate all the messages sent to Stderr in gnatcheck.log" );
726- Info (" -s - short form of the report file" );
727- Info (" -xml - generate report in XML format" );
728- Info (" -nt - do not generate text report (enforces '-xml')" );
729- Info (" " );
730- Info (" --show-rule - append rule names to diagnoses generated" );
731- Info (" --show-instantiation-chain - show instantiation chain for reported generic construct" );
732- Info (" " );
733- Info (" --brief - brief mode, only report detections in Stderr" );
734- Info (" --check-redefinition - issue warning if a rule parameter is redefined" );
735- Info (" --check-semantic - check semantic validity of the source files" );
736- Info (" --charset=<charset> - specify the charset of the source files" );
619+ Put_Line (" gnatcheck: the GNAT rule checking tool" );
620+ Put_Line (" usage: gnatcheck [options] {filename} {-files=filename} -rules rule_switches [-cargs gcc_switches]" );
621+ Put_Line (" options:" );
622+ Put_Line (" --version - Display version and exit" );
623+ Put_Line (" --help - Display usage and exit" );
624+ Put_Line (" " );
625+ Put_Line (" -Pproject - Use project file project. Only one such switch can be used" );
626+ Put_Line (" -U - check all sources of the argument project" );
627+ Put_Line (" -U main - check the closure of units rooted at unit main" );
628+ Put_Line (" --no-subprojects - process only sources of root project" );
629+ Put_Line (" -Xname=value - specify an external reference for argument project file" );
630+ Put_Line (" --subdirs=dir - specify subdirectory to place the result files into" );
631+ Put_Line (" --no_objects_dir - place results into current dir instead of project dir" );
632+ Put_Line (" -eL - follow all symbolic links when processing project files" );
633+ Put_Line (" " );
634+ Put_Line (" --ignore-project-switches - ignore switches specified in the project file" );
635+ Put_Line (" --target=targetname - specify a target for cross platforms" );
636+ Put_Line (" --RTS=<runtime> - use runtime <runtime>" );
637+ Put_Line (" --config=<cgpr> - use configuration project <cgpr>" );
638+ 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')" );
651+ Put_Line (" " );
652+ Put_Line (" --show-rule - append rule names to diagnoses generated" );
653+ Put_Line (" --show-instantiation-chain - show instantiation chain for reported generic construct" );
654+ Put_Line (" " );
655+ Put_Line (" --brief - brief mode, only report detections in Stderr" );
656+ Put_Line (" --check-redefinition - issue warning if a rule parameter is redefined" );
657+ Put_Line (" --check-semantic - check semantic validity of the source files" );
658+ Put_Line (" --charset=<charset> - specify the charset of the source files" );
737659
738660 if not Legacy then
739- Info (" --rules-dir=<dir> - specify an alternate directory containing rule files" );
661+ Put_Line (" --rules-dir=<dir> - specify an alternate directory containing rule files" );
740662 end if ;
741663
742- Info (" " );
743- Info (" --include-file=filename - add the content of filename into generated report" );
744- Info (" " );
745- Info (" -o filename - specify the name of the text report file" );
746- Info (" -ox filename - specify the name of the XML report file (enforces '-xml')" );
747- Info (" " );
748- Info (" filename - the name of the Ada source file to be analyzed." );
749- Info (" Wildcards are allowed" );
750- Info (" -files=filename - the name of the text file containing a list of Ada" );
751- Info (" source files to analyze" );
752- Info (" --ignore=filename - do not process sources listed in filename" );
753- Info (" --rule-file=filename - read rule configuration from the given LKQL file" );
754- Info (" -r, --rule [rule_name] - enable the given rule during the GNATcheck run (this option is cumulative)" );
755- Info (" --emit-lkql-rule-file - emit a 'rules.lkql' file containing the rules configuration" );
756- Info (" " );
757- Info (" rule_switches - a list of the following switches" );
758- Info (" -from=filename - read rule options from filename" );
759- Info (" +R<rule_id>[:param] - turn ON a given rule [with given parameter]" );
760- Info (" -R<rule_id> - turn OFF a given rule" );
761- Info (" -R<rule_id>:param - turn OFF some of the checks for a given rule," );
762- Info (" depending on the specified parameter" );
763- Info (" where <rule_id> - ID of one of the currently implemented" );
764- Info (" rules, use '-h' for the full list" );
765- Info (" param - string representing parameter(s) of a given rule, more than " );
766- Info (" one parameter can be set separated by ','" );
664+ Put_Line (" " );
665+ Put_Line (" --include-file=filename - add the content of filename into generated report" );
666+ Put_Line (" " );
667+ Put_Line (" -o filename - specify the name of the text report file" );
668+ Put_Line (" -ox filename - specify the name of the XML report file (enforces '-xml')" );
669+ Put_Line (" " );
670+ Put_Line (" filename - the name of the Ada source file to be analyzed." );
671+ Put_Line (" Wildcards are allowed" );
672+ Put_Line (" -files=filename - the name of the text file containing a list of Ada" );
673+ Put_Line (" source files to analyze" );
674+ Put_Line (" --ignore=filename - do not process sources listed in filename" );
675+ Put_Line (" --rule-file=filename - read rule configuration from the given LKQL file" );
676+ Put_Line (" -r, --rule [rule_name] - enable the given rule during the GNATcheck run (this option is cumulative)" );
677+ Put_Line (" --emit-lkql-rule-file - emit a 'rules.lkql' file containing the rules configuration" );
678+ Put_Line (" " );
679+ Put_Line (" rule_switches - a list of the following switches" );
680+ Put_Line (" -from=filename - read rule options from filename" );
681+ Put_Line (" +R<rule_id>[:param] - turn ON a given rule [with given parameter]" );
682+ Put_Line (" -R<rule_id> - turn OFF a given rule" );
683+ Put_Line (" -R<rule_id>:param - turn OFF some of the checks for a given rule," );
684+ Put_Line (" depending on the specified parameter" );
685+ Put_Line (" where <rule_id> - ID of one of the currently implemented" );
686+ Put_Line (" rules, use '-h' for the full list" );
687+ Put_Line (" param - string representing parameter(s) of a given rule, more than " );
688+ Put_Line (" one parameter can be set separated by ','" );
767689
768690 pragma Style_Checks (" M79" );
769691 end Brief_Help ;
@@ -774,7 +696,6 @@ package body Gnatcheck.Output is
774696
775697 procedure Print_Gnatcheck_Usage is
776698 begin
777- Set_Error (Standard_Output);
778699 Brief_Help;
779700 New_Line;
780701 Put_Line (
" Report bugs to [email protected] " );
0 commit comments