maintMakefile MAKE_CFLAGS: Does the `-C` option do anything?

Pete Dietl <[email protected]>
Newsgroups gmane.comp.gnu.make.bugs
Message-ID <CACB-c0HEo+mvcXPaBixTsPxoQpsmxWYu7rP9AeReoM5AWSgbjA@mail.gmail.com>
In commit `1dfd55ca`, the added comment in `maintMakefile` reads:

> # Also force comments to be preserved.  This helps when using ccache, in
> # combination with GCC 7's implicit-fallthrough warning.

I am curious how this helps ccache. I tried running GCC with and without
the flags and it seems to have no effect.
You can try it for yourself with this script:

 #!/usr/bin/env bash

set -ux

cd $(mktemp -d)

cat > main.c <<EOF
#include <stdio.h>

// This is a comment!

int main()
{
  puts("Hello, the wonderful people in the bug-make mailing list!\n");
  return 0;
}
EOF

echo "GCC version: $(gcc --version)"

MAINT_MAKEFILE_OPTS='-Wall -Wextra -Werror -Wwrite-strings -Wshadow
-Wdeclaration-after-statement -Wbad-function-cast -Wformat-security
-Wtype-limits -Wunused-but-set-parameter -Wlogical-op -Wpointer-arith
-Wignored-qualifiers -Wformat-signedness -Wduplicated-cond -g -O2 -c'
MY_OPTS='-gno-record-gcc-switches'

gcc $MAINT_MAKEFILE_OPTS $MY_OPTS -o main1.o main.c
gcc $MAINT_MAKEFILE_OPTS $MY_OPTS -C -o main2.o main.c

diff --report-identical-files main1.o main2.o

You should see the resulting files are identical.


The reason I ask is because I am using the `clangd` language server in
neovim (using the `bear` tool to generate a `compile_commands.json` file)
and it works great expect that I always get this error: `Invalid argument
'-C' only allowed with '-E'`. I am thinking that `gcc` just silently
ignores the `-C` switch when `-E` is not also specified, unless I'm missing
something. If I am correct, can we remove the `-C` flag from
`maintMakefile`?
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.