Commit b1499379 authored by Martin Dørum's avatar Martin Dørum

some small fixes

parent 2b2744bf
......@@ -27,8 +27,8 @@ In theory, this should always work; any implementation of C which conforms to
all of C11 will define `__STDC_VERSION__` as `201112L`, while any
implementation which doesn't conform to C11, but conforms to some earlier
version, will define `__STDC_VERSION__` to be less than `201112L`. Therefore,
unless the `_Generic` feature gets removed in a future version of the standard,
`__STDC_VERSION__ >= 201112L` means that we can safely use `_Generic`.
unless the \_Generic feature gets removed in a future version of the standard,
`__STDC_VERSION__ >= 201112L` means that we can safely use \_Generic.
Sadly, the real world is not that clean.
You could already in GCC 4.7 enable C11 by passing in `-std=c11`,
......@@ -51,7 +51,7 @@ That works well enough, but there's one problem:
GCC 4.9 supports all of C11 just fine, but only if we give it `-std=c11`.
GCC 4.9 also seems to be one of those annoyingly widespread versions of GCC,
so we'd prefer to encourage users to set `-std=c11` and make the
macros which rely on `_Generic` work in GCC 4.9.
macros which rely on \_Generic work in GCC 4.9.
Again, the solution seems obvious enough, if a bit ugly:
if the compiler is GCC, we only use `_Genric` if the GCC version is 4.9 or
......@@ -71,8 +71,8 @@ This should in theory work perfectly:
#endif
```
Our new `IS_C11` macro should now always be defined if we can use `_Generic`
and always not be defined when we can't use `_Generic`, right?
Our new `IS_C11` macro should now always be defined if we can use \_Generic
and always not be defined when we can't use \_Generic, right?
Wrong. It turns out that in their quest to support code written for GCC, Clang
also defines the `__GNUC__`, `__GNUC_MINOR__`, and `__GNUC_PATCHLEVEL__`
......@@ -108,7 +108,7 @@ The Intel compiler is at least nice enough to define `__GNUC__` and
so even though our version check is completely irrelevant in the Intel
compiler,
at least it will only prevent an otherwise C11-compliant Intel compiler
from using `_Generic` if the user has an older version of GCC installed.
from using \_Generic if the user has an older version of GCC installed.
> **User**: Hi, I'm using the Intel compiler, and your library claims
> my compiler doesn't support C11, even though it does.
......@@ -270,14 +270,14 @@ unless `SNOW_ENABLED` is defined.
My personal philosophy is that your regular builds should _not_ have `-Werror`,
and that your testing builds should have as strict warnings as possible and be
compiled with `-Werror`.
Your users might be using a different compiler version than you are,
Your users may be using a different compiler version from you,
and that compiler might produce some warnings which you haven't fixed yet.
Being a user of a rolling release, with a very recent of GCC,
Being a user of a rolling release distro, with a very recent of GCC,
I have way too often had to edit someone else's Makefile and remove `-Werror`
just to make their code compile.
Compiling the test suite with `-Werror` and regular builds without `-Werror`
has none of the drawbacks of using `-Werror` for regular builds, and none of
the drawbacks
has none of the drawbacks of using `-Werror` for regular builds,
and most or all of the advantages
(at least if you don't accept contributions which break your test suite).
This all means that I want to be able to compile all files with at least
......@@ -297,7 +297,7 @@ We just include `#pragma GCC diagnostic ignored "-Wpedantic"` somewhere.
Well, as it turns out, disabling `-Wpedantic` with a pragma doesn't disable all
the warnings enabled by `-Wpedantic`;
there are some warnings which are impossible to disable once they're enabled.
One such warning is about using directives (like `ifdef`) inside macro
One such warning is about using directives (like `#ifdef`) inside macro
arguments.
As I explained earlier,
_everything_ in Snow happens inside of macro arguments.
......@@ -321,10 +321,11 @@ disable that particular warning with a pragma.
To be completely honest, this issue makes complete sense.
I imagine the preprocessor stage, which is where macros are expanded,
doesn't know about pragmas, and implementing pragma parsing for the
doesn't care much about pragmas.
It feels unnecessary to implement pragma parsing for the
preprocessor _just_ in order to let people compile files with `-Wpedantic` but
still selectively disable this particular warning.
That doesn't mean that it's any less annoying though.
That doesn't make it less annoying though.
Funnily enough, I encountered this issue while writing Snow's test suite.
My solution was to just define
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment