[Libreoffice-commits] -Werror=format-security

Michael Meeks michael.meeks at suse.com
Tue Aug 7 04:28:22 PDT 2012


On Tue, 2012-08-07 at 09:23 +0200, Stephan Bergmann wrote:
> Folks, please do not pollute the sources with fprintf in the first 
> place.

	Of course that doesn't belong in master but ...

>   Use SAL_INFO/SAL_WARN for permanent warning code (see 
> <http://wiki.documentfoundation.org/Development#Assertions_and_Logging>), and 
> use SAL_DEBUG for temporary debug output (that the LO git commit hooks 
> will prevent from accidentally becoming permanent).

	I always use fprintf and never these other things. I can never remember
how to make SAL_WARN / SAL_INFO / SAL_DEBUG to actually output something
and grok their prefix behaviour etc.; on the occasions I've tried adding
one of those I inevitably have to do 2x compilation loops before giving
up and using fprintf - IIRC you have to use some different compile
flags, and/or set some also-difficult-to-remember environment variable
to some value - right ?

	fprintf (stderr,"foo\n");

	goes directly, atomically to your terminal pausing the app until it's
out and it -just-works- (TM) ;-)

	And - unfortunately, there's no way re-explaining it is going to help
me remember the detail ;-) -possibly- adding a:

	./soffice --help-debug

	section that explains what to set SAL_LOG to, and some of the other
environment variables to set to debug various other things might help
keep that near the front of people's minds but ...

	Quite possibly if we want to keep fprintf's out we want to add a git
hook that excludes them from ~everywhere-but-sal or whatever.

	Hey ho,

		Michael.

-- 
michael.meeks at suse.com  <><, Pseudo Engineer, itinerant idiot



More information about the LibreOffice mailing list