public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Ada] Fix ineffective -gnatyN for separate compilation units
@ 2019-09-17  8:06 Pierre-Marie de Rodat
  0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2019-09-17  8:06 UTC (permalink / raw)
  To: gcc-patches; +Cc: Eric Botcazou

[-- Attachment #1: Type: text/plain, Size: 902 bytes --]

This fixes a recent regression introduced in the machinery giving style
warnings: the -gnatyN switch no longer cancels an earlier -gnaty switch
for separate compilation units.

Running this command:

  gcc -c slib.adb -gnatyaAbcefhiIklmM25OnprStux -gnatyN

On the following sources:

package Slib is
   procedure I_Am_Short;
end Slib;

with Ada.Text_IO; use Ada.Text_IO;

package body Slib is
   --  have a long line here as well.
   procedure                I_Am_Short is               separate;
end Slib;

separate (Slib)

procedure I_Am_Short is
begin
    Put_Line (".......................................................");
end I_Am_Short;

Should execute silently.

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

2019-09-17  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

	* sem.adb (Do_Analyze): Save Style_Check_Max_Line_Length on
	entry and restore it on exit instead of recomputing it.

[-- Attachment #2: patch.diff --]
[-- Type: text/x-diff, Size: 795 bytes --]

--- gcc/ada/sem.adb
+++ gcc/ada/sem.adb
@@ -1360,7 +1360,8 @@ package body Sem is
          --  unconditionally, and has no restore mechanism, because it is
          --  intended as a lowest-level Pure package.
 
-         Saved_ML : constant Int := Style_Max_Line_Length;
+         Saved_ML  : constant Int     := Style_Max_Line_Length;
+         Saved_CML : constant Boolean := Style_Check_Max_Line_Length;
 
          List : Elist_Id;
 
@@ -1395,7 +1396,7 @@ package body Sem is
          Restore_Scope_Stack  (List);
          Restore_Ghost_Region (Saved_GM, Saved_IGR);
          Style_Max_Line_Length := Saved_ML;
-         Style_Check_Max_Line_Length := Style_Max_Line_Length /= 0;
+         Style_Check_Max_Line_Length := Saved_CML;
       end Do_Analyze;
 
       --  Local variables


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-09-17  8:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-17  8:06 [Ada] Fix ineffective -gnatyN for separate compilation units Pierre-Marie de Rodat

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).