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

From: "brian m. carlson" <[email-masked]>
Date: Tue, 16 Nov 2021 01:53:52 +0000

On 2021-11-15 at 03:16:02, Eric Sunshine wrote:
> On Sun, Nov 14, 2021 at 4:27 PM brian m. carlson
> <[email-masked]> 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 [email-masked].
> > + */
> > +#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