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

Fixing the warning about warning(""); was: Re: [PATCH] difftool.c: mark a file-local symbol with static

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Jan 25, 2017, 10:36 UTC
Message-ID
<alpine.DEB.2.20.1701251135090.3469@virtualbox>
In-Reply-To
<20170124230500.h3fasbvutjkkke5h@sigill.intra.peff.net>
Hi Peff,
On Tue, 24 Jan 2017, Jeff King wrote:
Show 35 quoted lines
> On Tue, Jan 24, 2017 at 01:52:13PM -0800, Junio C Hamano wrote:
> 
> > > I dunno. As ugly as the "%s" thing is in the source, at least it
> > > doesn't change the output. Not that an extra space is the end of the
> > > world, but it seems like it's letting the problem escape from the
> > > source code.
> > >
> > > Do people still care about resolving this? -Wno-format-zero-length
> > > is in the DEVELOPER options. It wasn't clear to me if that was
> > > sufficient, or if we're going to get a bunch of reports from people
> > > that need to be directed to the right compiler options.
> > 
> > I view both as ugly, but probably "%s", "" is lessor of the two evils.
> > 
> > Perhaps
> > 
> > 	#define JUST_SHOW_EMPTY_LINE "%s", ""
> > 
> > 		...
> > 		warning(JUST_SHOW_EMPTY_LINE);
> >                 ...
> > 
> > or something silly like that?
> 
> Gross, but at least it's self documenting. :)
> 
> I guess a less horrible version of that is:
> 
>   static inline warning_blank_line(void)
>   {
> 	warning("%s", "");
>   }
> 
> We'd potentially need a matching one for error(), but at last it avoids
> macro trickery.

I fail to see how this function, or this definition, makes the code better than simply calling `warning("%s", "");` and be done with it.

Ciao, Johannes

Previous: Jeff KingNext: Jeff King
Message 17 of 28 in “difftool.c: mark a file-local symbol with static”
  1. difftool.c: mark a file-local symbol with staticRamsay Jones, Nov 29, 2016
  2. Johannes SchindelinNov 30, 2016
  3. Ramsay JonesNov 30, 2016
  4. Junio C HamanoNov 30, 2016
  5. Jeff KingNov 30, 2016
  6. Ramsay JonesNov 30, 2016
  7. Jeff KingNov 30, 2016
  8. Junio C HamanoNov 30, 2016
  9. Ramsay JonesDec 1, 2016
  10. Jeff KingDec 1, 2016
  11. Junio C HamanoDec 1, 2016
  12. Jeff KingDec 1, 2016
  13. David AguilarJan 22, 2017
  14. Jeff KingJan 24, 2017
  15. Junio C HamanoJan 24, 2017
  16. Jeff KingJan 24, 2017
  17. Fixing the warning about warning(""); was: Re: [PATCH] difftool.c: mark a file-local symbol with staticJohannes Schindelin, Jan 25, 2017
  18. Jeff KingJan 25, 2017
  19. Junio C HamanoJan 25, 2017
  20. Jeff KingJan 25, 2017
  21. Johannes SixtJan 26, 2017
  22. Johannes SchindelinJan 26, 2017
  23. Jeff KingJan 26, 2017
  24. Jeff KingJan 26, 2017
  25. Junio C HamanoJan 26, 2017
  26. Johannes SchindelinJan 26, 2017
  27. Jeff KingJan 26, 2017
  28. Johannes SchindelinJan 26, 2017

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.