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

Will -fsyntax-only hide issues with -pedantic? I think not...

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Nov 30, 2021, 13:13 UTC
Message-ID
<211130.86ilw9epy3.gmgdl@evledraar.gmail.com>

The answer to $subject is not at all urgent, but I noticed we can get some (very modest) speed increases in the "pedantic" CI job when adding -fsyntax-only to CFLAGS. This currently requires monkeypatching out the "-o <target> -c" part hardcoded in the Makefile. See cebead1ebfb (ci: run a pedantic build as part of the GitHub workflow, 2021-08-08) for the pedantic job.

I.e. I'm aware of CFLAGS's -O<n> changing which warings we emit, but does -fsyntax-only?

The gcc manpage suggests that it would, saying:
    Check the code for syntax errors, but don't do anything beyond that
Whereas clang's says:
    Run the preprocessor, parser and type checking stages. 
I think gcc's is a case of its docs drifting out of sync with the
implementation. Both will warn on e.g. this program under -pedantic,
which gcc wouldn't be doing if it only did syntax parsing (and didn't
run the warning machinery):
    
    int main(void)
    {
            int v[0];
            return 0;
    }

I don't have any practical use for this now. We could squeeze some slight performance out of one CI jobs, but perhaps it'll be more interesting in the future.

Next: Jeff King
Message 1 of 2 in “Will -fsyntax-only hide issues with -pedantic? I think not...”
  1. Ævar Arnfjörð BjarmasonNov 30, 2021
  2. Jeff KingNov 30, 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.