The use of -gnatR in check semantics only (-gnatc) mode does not work since code must be generated for -gnatR to work. The attempt to combine the two switches is now properly diagnosed. The following trivial package
1. package gnatrgnatc is 2. end; If compiled with switches -gnatc -gnatR2, outputs: gnat1: -gnatR not permitted since -gnatc given previously If compiled with switches -gnatR2 -gnatc, outputs: gnat1: -gnatc not allowed since previous -gnatR given Tested on x86_64-pc-linux-gnu, committed on trunk 2013-09-10 Robert Dewar <de...@adacore.com> * gnat_ugn.texi: Document that -gnatc and -gnatR cannot be given together. * switch-c.adb (Scan_Front_End_Switches): Give error if both -gnatR and -gnatc given.
Index: switch-c.adb =================================================================== --- switch-c.adb (revision 202451) +++ switch-c.adb (working copy) @@ -310,6 +310,13 @@ ("-gnatc must be first if combined with other switches"); end if; + -- Not allowed if previous -gnatR given + + if List_Representation_Info /= 0 then + Osint.Fail + ("-gnatc not allowed since -gnatR given previously"); + end if; + Ptr := Ptr + 1; Operating_Mode := Check_Semantics; @@ -1013,6 +1020,14 @@ ("-gnatR not permitted since -gnatD given previously"); end if; + -- Not allowed if previous -gnatc was given, since we must + -- call the code generator to determine rep information. + + if Operating_Mode = Check_Semantics then + Osint.Fail + ("-gnatR not permitted since -gnatc given previously"); + end if; + -- Set to annotate rep info, and set default -gnatR mode Back_Annotate_Rep_Info := True; Index: gnat_ugn.texi =================================================================== --- gnat_ugn.texi (revision 202451) +++ gnat_ugn.texi (working copy) @@ -3697,7 +3697,9 @@ @option{-gnatc} as a builder switch (before @option{-cargs} or in package Builder of the project file) then @command{gnatmake} will not fail because it will not look for the object files after compilation, and it will not try -to build and link. +to build and link. This switch may not be given if a previous @code{-gnatR} +switch has been given, since @code{-gnatR} requires that the code generator +be called to complete determination of representation information. @item -gnatC @cindex @option{-gnatC} (@command{gcc}) @@ -4006,8 +4008,10 @@ @item ^-gnatR@r{[}0@r{/}1@r{/}2@r{/}3@r{[}s@r{]]}^/REPRESENTATION_INFO^ @cindex @option{-gnatR} (@command{gcc}) Output representation information for declared types and objects. -Note that this switch is not allowed if a previous --gnatD switch has been given, since these two switches are not compatible. +Note that this switch is not allowed if a previous @code{-gnatD} switch has +been given, since these two switches are not compatible. It is also not allowed +if a previous @code{-gnatc} switch has been given, since we must be generating +code to be able to determine representation information. @item -gnats @cindex @option{-gnats} (@command{gcc})