Using clang 3.8 with -Wreserved-id-macro (enabled by -Weverything), I
just noticed that SQLite uses include guards with a leading underscore,
for example _SQLITE3_H_ in the amalgamation. According to the C
standard, this is a reserved identifier, leading to undefined behavior:

> All identifiers that begin with an underscore and either an uppercase
> letter or another underscore are always reserved for any use. [...]
> If the program declares or defines an identifier in a context in
> which it is reserved (other than as allowed by 7.1.4), or defines a
> reserved identifier as a macro name, the behavior is undefined.

(Source: the C11 standard, Section 7.1.3, see [1] for the latest draft
of C11 before publication, which should be identical to the finished text)

I guess that means that the include guards should be changed to no
longer use leading underscores. Any opinions on that?

Daniel

[1] http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to