git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 1/1] git-compat-util: add a test balloon for C99 support

From
brian m. carlson <sandals@crustytoothpaste.net>
Date
Nov 16, 2021, 01:53 UTC
Message-ID
<YZMPMFiQmtgfp15H@camp.crustytoothpaste.net>
In-Reply-To
<CAPig+cTAfOor11SDWG0N-eeZZ=4hsmkMVAdcmiiJ+jXz3BAQVQ@mail.gmail.com>
On 2021-11-15 at 03:16:02, Eric Sunshine wrote:
Show 14 quoted lines
> On Sun, Nov 14, 2021 at 4:27 PM brian m. carlson
> <sandals@crustytoothpaste.net> wrote:
> > +#if __STDC_VERSION__ - 0 < 199901L
> > +/*
> > + * Git is in a testing period for mandatory C99 support in the compiler.  If
> > + * your compiler is reasonably recent, you can try to enable C99 support (or,
> > + * for MSVC, C11 support).  If you encounter a problem and can't enable C99
> > + * support with your compiler and don't have access to one with this support,
> > + * such as GCC or Clang, you can remove this #if directive, but please report
> > + * the details of your system to git@vger.kernel.org.
> > + */
> > +#error "Required C99 support is in a test phase.  Please see git-compat-util.h for more details."
> 
> You don't need to encapsulate the #error message in double quotes.

Technically, I believe in this case you are correct. The C standard specifies this as pp-tokens, which means one or more preprocessing tokens, and from my brief overview of the draft standard, it appears that this meets that definition. (I could be wrong, though.)

_However_, there are some cases where quoting is required, such as when apostrophes appear, and although we don't have that case here, there are some compilers which are very strict about what they do or don't allow in an #error statement, or which are just broken, and as such, in my experience, it is safer and more portable to always quote it. I definitely don't want us to have the problem that we break an otherwise functional compiler by causing it to choke on the #error directive it doesn't need to execute.

-- 
brian m. carlson (he/him or they/them)
Toronto, Ontario, CA
Previous: Eric SunshineNext: Johannes Schindelin
Message 6 of 32 in “Add a test balloon for C99”
  1. 0/1 Add a test balloon for C99brian m. carlson, Nov 14, 2021
  2. 1/1 git-compat-util: add a test balloon for C99 supportbrian m. carlson, Nov 14, 2021
  3. Ævar Arnfjörð BjarmasonNov 15, 2021
  4. brian m. carlsonNov 15, 2021
  5. Eric SunshineNov 15, 2021
  6. brian m. carlsonNov 16, 2021
  7. Johannes SchindelinNov 22, 2021
  8. brian m. carlsonNov 14, 2021
  9. Junio C HamanoNov 15, 2021
  10. brian m. carlsonNov 15, 2021
  11. Junio C HamanoNov 16, 2021
  12. brian m. carlsonNov 17, 2021
  13. 0/1 Add a test balloon for C99 supportbrian m. carlson, Nov 16, 2021
  14. 1/1 git-compat-util: add a test balloon for C99 supportbrian m. carlson, Nov 16, 2021
  15. Jeff KingNov 16, 2021
  16. Ævar Arnfjörð BjarmasonNov 16, 2021
  17. Jeff KingNov 16, 2021
  18. brian m. carlsonNov 17, 2021
  19. Jeff KingNov 17, 2021
  20. brian m. carlsonNov 17, 2021
  21. Carlo ArenasNov 17, 2021
  22. Ævar Arnfjörð BjarmasonNov 18, 2021
  23. Junio C HamanoNov 18, 2021
  24. Junio C HamanoNov 17, 2021
  25. Phillip WoodNov 16, 2021
  26. brian m. carlsonNov 17, 2021
  27. Jeff KingNov 17, 2021
  28. Microsoft's C language policy (was: [PATCH 0/1] Add a test balloon for C99)Ævar Arnfjörð Bjarmason, Nov 30, 2021
  29. brian m. carlsonNov 30, 2021
  30. 0/1 Add a test balloon for C99 supportbrian m. carlson, Dec 1, 2021
  31. 1/1 git-compat-util: add a test balloon for C99 supportbrian m. carlson, Dec 1, 2021
  32. Johannes SchindelinDec 2, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.