https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100251
Bug ID: 100251
Summary: Byte order mark in gnat.adc raises compilation error
Product: gcc
Version: 10.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: ada
Assignee: unassigned at gcc dot gnu.org
Reporter: stephen.sangwine at btinternet dot com
Target Milestone: ---
Created attachment 50671
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50671&action=edit
Trivial gnat.adc file starting with a BOM.
When using gnatmake to compile an Ada program (any program, even a Hello World
program), if a gnat.adc file exists in the directory where the main source file
is located, and gnat.adc starts with a byte order mark (BOM), the gnat compiler
reports the following error and compilation fails:
gnatmake: gnat.adc:1:1: non pragma encountered
Why is this an issue? LRM 2.1(16/3) specifies that source code files containing
a BOM shall be accepted. The Gnat User Guide section 3.4.2 says that gnat.adc
is in the same format as a source code file. Therefore one would expect that a
BOM in gnat.adc would be accepted.
If you wish to format Ada source code files with a BOM, it is handy to set your
editor to add the BOM if not present. Yet if you then edit gnat.adc with the
same editor, a BOM will be inserted, and your next compilation will fail.