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

Re: [PATCH 3/3] Makefile: use -Wdeclaration-after-statement if supported

From
Adam Spiers <git@adamspiers.org>
Date
Dec 22, 2012, 12:25 UTC
Message-ID
<CAOkDyE_+3n8PS_6vs-HG6v5A4SirBPVVCdgeUPOPpwaNpkk9Uw@mail.gmail.com>
In-Reply-To
<7v8v8xpazq.fsf@alter.siamese.dyndns.org>
On Mon, Dec 17, 2012 at 4:18 AM, Junio C Hamano <gitster@pobox.com> wrote:
Show 13 quoted lines
> Adam Spiers <git@adamspiers.org> writes:
>
>> OK; I expect these issues with the implementation are all
>> surmountable.  I did not necessarily expect this to be the final
>> implementation anyhow, as indicated by my comments below the divider
>> line.  However it's not clear to me what you think about the idea in
>> principle, and whether other compiler flags would merit inclusion.
>
> As different versions of GCC behave differently, and the same GCC
> (mis)detect issues differently depending on the optimization level,
> I do not know if it will be a fruitful exercise to try to come up
> with one expression to come up with the set of flags to suit
> everybody.

Fair enough, but let's not allow perfect to become the enemy of good. Other flags aside, surely enabling -Wdeclaration-after-statement when it is available is an improvement on the status quo, if it is done in a way which doesn't damage the current build process? History shows quite a few instances of other developers falling into the same trap I did, e.g.

  http://search.gmane.org/search.php?group=gmane.comp.version-control.git&query=decl-after-statement

So if the check was automated in the majority of cases (I guess the majority of developers use gcc), it would mean less review work for you and fewer re-rolls. If you agree, I will try to rework the patch so that it doesn't damage the build.

> One flag I prefer to use is -Werror, but that means the
> other flags must have zero false positive rate.

Personally I'm a fan of -Werror too. How frequent are false positives, and are any of them ever insurmountable?

> If you are interested, the flags I personally use with the version
> of GCC I happen to have is in the Make script on the 'todo' branch.
Thanks for the info.
Previous: Junio C HamanoNext: Junio C Hamano
Message 9 of 10 in “Help newbie git developers avoid obvious pitfalls”
  1. 0/3 Help newbie git developers avoid obvious pitfallsAdam Spiers, Dec 16, 2012
  2. 1/3 SubmittingPatches: add convention of prefixing commit messagesAdam Spiers, Dec 16, 2012
  3. Junio C HamanoDec 16, 2012
  4. 2/3 Documentation: move support for old compilers to CodingGuidelinesAdam Spiers, Dec 16, 2012
  5. 3/3 Makefile: use -Wdeclaration-after-statement if supportedAdam Spiers, Dec 16, 2012
  6. Junio C HamanoDec 17, 2012
  7. Adam SpiersDec 17, 2012
  8. Junio C HamanoDec 17, 2012
  9. Adam SpiersDec 22, 2012
  10. Junio C HamanoDec 22, 2012

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.