From bac865a217a819eb5cf90af6962904241168f167 Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Tue, 25 Apr 2017 14:01:32 +0200 Subject: [PATCH] Code clenups. From-SVN: r247193 --- gcc/ada/bindgen.adb | 2 +- gcc/ada/gnatchop.adb | 4 ++-- gcc/ada/s-dimmks.ads | 7 ++++++- gcc/ada/s-wchcnv.adb | 2 +- gcc/ada/sinput.adb | 4 +++- gcc/ada/sinput.ads | 4 ++-- gcc/ada/styleg.adb | 9 ++++++--- 7 files changed, 21 insertions(+), 11 deletions(-) diff --git a/gcc/ada/bindgen.adb b/gcc/ada/bindgen.adb index 5544c8244b7..fff65d2cb20 100644 --- a/gcc/ada/bindgen.adb +++ b/gcc/ada/bindgen.adb @@ -2717,7 +2717,7 @@ package body Bindgen is -- every file, then we could use the encoding of the initial specified -- file, but this information is passed only for potential main -- programs. We could fix this sometime, but it is a very minor point - -- (wide character default encoding for [Wide_[Wide_]Text_IO when there + -- (wide character default encoding for [Wide_[Wide_]]Text_IO when there -- is no main program). elsif No_Main_Subprogram then diff --git a/gcc/ada/gnatchop.adb b/gcc/ada/gnatchop.adb index c638c4551b5..c6276021bfc 100644 --- a/gcc/ada/gnatchop.adb +++ b/gcc/ada/gnatchop.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1998-2014, Free Software Foundation, Inc. -- +-- Copyright (C) 1998-2016, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -1424,7 +1424,7 @@ procedure Gnatchop is -- Test for presence of BOM - Read_BOM (Buffer.all, BOM_Length, BOM, False); + Read_BOM (Buffer.all, BOM_Length, BOM, XML_Support => False); BOM_Present := BOM /= Unknown; -- Only chop those units that come from this file diff --git a/gcc/ada/s-dimmks.ads b/gcc/ada/s-dimmks.ads index 48771d01c36..1b131c411ab 100644 --- a/gcc/ada/s-dimmks.ads +++ b/gcc/ada/s-dimmks.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 2011-2013, Free Software Foundation, Inc. -- +-- Copyright (C) 2011-2016, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -186,6 +186,11 @@ package System.Dim.Mks is Ampere => -1, others => 0); + -- Note the type punning below. The Symbol is a single "ohm" character + -- encoded in UTF-8 (ce a9 in hexadecimal), but this file is not compiled + -- with -gnatW8, so we're treating the string literal as a two-character + -- String. + subtype Electric_Resistance is Mks_Type with Dimension => (Symbol => "Ω", diff --git a/gcc/ada/s-wchcnv.adb b/gcc/ada/s-wchcnv.adb index 7e2ab08e55b..07ccc5cb348 100644 --- a/gcc/ada/s-wchcnv.adb +++ b/gcc/ada/s-wchcnv.adb @@ -406,7 +406,7 @@ package body System.WCh_Cnv is when WCEM_Brackets => -- Values in the range 0-255 are directly output. Note that there - -- is some issue with [ (16#5B#] since this will cause confusion + -- is an issue with [ (16#5B#) since this will cause confusion -- if the resulting string is interpreted using brackets encoding. -- One possibility would be to always output [ as ["5B"] but in diff --git a/gcc/ada/sinput.adb b/gcc/ada/sinput.adb index 4b4775734b3..4d0cbddec37 100644 --- a/gcc/ada/sinput.adb +++ b/gcc/ada/sinput.adb @@ -272,11 +272,13 @@ package body Sinput is Tst (J) := C; end loop; - Read_BOM (Tst, Len, BOM, False); + Read_BOM (Tst, Len, BOM, XML_Support => False); case BOM is when UTF8_All => Scan_Ptr := Scan_Ptr + Source_Ptr (Len); + First_Non_Blank_Location := Scan_Ptr; + Current_Line_Start := Scan_Ptr; Wide_Character_Encoding_Method := WCEM_UTF8; Upper_Half_Encoding := True; diff --git a/gcc/ada/sinput.ads b/gcc/ada/sinput.ads index 8165a8f6dea..ef7f3885cc2 100644 --- a/gcc/ada/sinput.ads +++ b/gcc/ada/sinput.ads @@ -560,8 +560,8 @@ package Sinput is -- the start of the current source. If the current source starts with a -- recognized BOM, then some flags such as Wide_Character_Encoding_Method -- are set accordingly, and the Scan_Ptr on return points past this BOM. - -- An error message is output and Unrecoverable_Error raised if a non- - -- recognized BOM is detected. The call has no effect if no BOM is found. + -- An error message is output and Unrecoverable_Error raised if an + -- unrecognized BOM is detected. The call has no effect if no BOM is found. function Get_Column_Number (P : Source_Ptr) return Column_Number; -- The ones-origin column number of the specified Source_Ptr value is diff --git a/gcc/ada/styleg.adb b/gcc/ada/styleg.adb index 58fd3fd3e05..f785205fe10 100644 --- a/gcc/ada/styleg.adb +++ b/gcc/ada/styleg.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2015, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2016, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -492,10 +492,13 @@ package body Styleg is -- Start of processing for Check_Comment begin - -- Can never have a non-blank character preceding the first minus + -- Can never have a non-blank character preceding the first minus. + -- The "+ 3" is to leave room for a possible byte order mark (BOM); + -- we want to avoid a warning for a comment at the start of the + -- file just after the BOM. if Style_Check_Comments then - if Scan_Ptr > Source_First (Current_Source_File) + if Scan_Ptr > Source_First (Current_Source_File) + 3 and then Source (Scan_Ptr - 1) > ' ' then Error_Msg_S -- CODEFIX -- 2.30.2