This is an archive of the discontinued LLVM Phabricator instance.

Document -std= values for different languages
ClosedPublic

Authored by dim on Apr 7 2018, 12:25 PM.

Details

Summary

After a remark on a FreeBSD mailing list that the clang man page did
not have any list of possible values for the -std= flag, I have now
attempted to exhaustively list those, for each available language.

This also includes a number of deprecated aliases, but since some of
those are still used, we might as well include them. They are marked
with '(deprecated)`.

I also documented the default standard for each language, if there was
more than one choice.

Suggestions on how to make the values and descriptions line up more
nicely in RST are welcome.

Diff Detail

Repository
rL LLVM

Event Timeline

dim created this revision.Apr 7 2018, 12:25 PM

To be honest, I find those '(deprecated)' confusing — the user may mistakenly assume that it's about all values rather than the alias.

docs/CommandGuide/clang.rst
105 ↗(On Diff #141500)

s/options/values/ I think.

dim added a comment.Apr 7 2018, 12:32 PM

To be honest, I find those '(deprecated)' confusing — the user may mistakenly assume that it's about all values rather than the alias.

Sure, what would you suggest as an alternative? Not listing them, listing them separately, using some sort of "*" suffix, or anything else?

rsmith added a comment.Apr 7 2018, 1:06 PM
In D45406#1060773, @dim wrote:

To be honest, I find those '(deprecated)' confusing — the user may mistakenly assume that it's about all values rather than the alias.

Sure, what would you suggest as an alternative? Not listing them, listing them separately, using some sort of "*" suffix, or anything else?

I think not listing them is probably best. We don't want anyone to specify them, after all.

dim updated this revision to Diff 141513.Apr 7 2018, 3:28 PM
  • Use "values" instead of "options"
  • Remove deprecated standard values

Well, my idea was to list the standards one per line (like on GCC manpage), and then the '(deprecated)' comments would probably stand out enough to apply to a single line. Also, FWICS the gcc manpage simply lists which aliases are deprecated in the description text. But skipping them entirely also works for me.

dim added a comment.Apr 8 2018, 3:14 AM

Well, my idea was to list the standards one per line (like on GCC manpage), and then the '(deprecated)' comments would probably stand out enough to apply to a single line. Also, FWICS the gcc manpage simply lists which aliases are deprecated in the description text. But skipping them entirely also works for me.

Right, I see what you mean (as per https://gcc.gnu.org/onlinedocs/gcc/C-Dialect-Options.html#index-std-1), I'm not completely sure how to force a line break in RST with itemized lists, though.

mgorny added a comment.Apr 8 2018, 3:29 AM

I think you'd want a definition list instead then. But I haven't tested if they can be nested inside option lists.

dim updated this revision to Diff 141529.Apr 8 2018, 4:06 AM

Attempt to put the standard values in to definition lists. In the HTML
output, this looks fairly nice, but as a man page, it seems a bit
strange, for example:

-std=<standard>
       Specify the language standard to compile for.

       Supported values for the C language are:
          c89
          c90
          iso9899:1990

             ISO C 1990
          iso9899:199409

             ISO C 1990 with amendment 1
          gnu89
          gnu90

             ISO C 1990 with GNU extensions
          c99
          iso9899:1999

             ISO C 1999
          gnu99

             ISO C 1999 with GNU extensions
          c11
          iso9899:2011

             ISO C 2011
          gnu11

             ISO C 2011 with GNU extensions
          c17
          iso9899:2017

             ISO C 2017
          gnu17

             ISO C 2017 with GNU extensions

       The default C language standard is gnu11, except on PS4, where
       it is gnu99.
dim added a comment.Apr 9 2018, 10:52 AM

So, does this look good enough to commit?

rsmith accepted this revision.Apr 11 2018, 3:00 AM

Looks good to me, thank you

This revision is now accepted and ready to land.Apr 11 2018, 3:00 AM
This revision was automatically updated to reflect the committed changes.