diff options
Diffstat (limited to 'gcc/ada/sinput.adb')
-rw-r--r-- | gcc/ada/sinput.adb | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/gcc/ada/sinput.adb b/gcc/ada/sinput.adb index 29be59a..a01c045 100644 --- a/gcc/ada/sinput.adb +++ b/gcc/ada/sinput.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2012, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2013, 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- -- @@ -258,10 +258,20 @@ package body Sinput is BOM : BOM_Kind; Len : Natural; Tst : String (1 .. 5); + C : Character; begin for J in 1 .. 5 loop - Tst (J) := Source (Scan_Ptr + Source_Ptr (J) - 1); + C := Source (Scan_Ptr + Source_Ptr (J) - 1); + + -- Definitely no BOM if EOF character marks either end of file, or + -- an illegal non-BOM character if not at the end of file. + + if C = EOF then + return; + end if; + + Tst (J) := C; end loop; Read_BOM (Tst, Len, BOM, False); |