Bug 1038070 - -Werror=format-security false positive on constant
Summary: -Werror=format-security false positive on constant
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: gcc
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 1037377
TreeView+ depends on / blocked
 
Reported: 2013-12-04 11:08 UTC by Karel Volný
Modified: 2014-02-03 19:00 UTC (History)
3 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2014-02-01 15:21:31 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
allmenus.cpp preprocessed (815.75 KB, text/plain)
2014-01-31 17:38 UTC, Karel Volný
no flags Details

Description Karel Volný 2013-12-04 11:08:03 UTC
Description of problem:
Recently, I got bug #1037377, where there are these errors:

allmenus.cpp:367:69: error: format not a string literal and no format arguments [-Werror=format-security]
allmenus.cpp:370:69: error: format not a string literal and no format arguments [-Werror=format-security]

The offending lines (both) read:

fprintf (stdout, bindtextdomain (PACKAGE, LOCALEDIR));

but PACKAGE and LOCALEDIR are constants defined by make, and to my best knowledge, a constant _is_ one of things that "string literal" stands for, so the error does not make any sense to me - I think it is a false positive.

Version-Release number of selected component (if applicable):
(ask dkholia about the environment)

How reproducible:
(haven't tried myself)

Steps to Reproduce:
1. rebuild vodovod package with -Werror=format-security

Actual results:
allmenus.cpp:367:69: error: format not a string literal and no format arguments [-Werror=format-security]
allmenus.cpp:370:69: error: format not a string literal and no format arguments [-Werror=format-security]
njamfont.cpp:119:44: error: format not a string literal and no format arguments [-Werror=format-security]
njamfont.cpp:128:44: error: format not a string literal and no format arguments [-Werror=format-security]


Expected results:
no errors

Additional info:

Comment 1 Jakub Jelinek 2013-12-07 07:30:49 UTC
Please attach preprocessed source.

Comment 2 Karel Volný 2014-01-31 17:38:22 UTC
Created attachment 857937 [details]
allmenus.cpp preprocessed

hope this is what are you asking for ...?

Comment 3 Jakub Jelinek 2014-02-01 15:21:31 UTC
The warning is correct, the bindtextdomain function certainly isn't a format_arg attribute function like e.g. gettext, etc., so you should of course use "%s", bindtextdomain (...) instead.

Comment 4 Karel Volný 2014-02-03 19:00:39 UTC
sorry for the noise then and thanks for the explanation in the other (not-a-)bug

(/me still doesn't understand what does it mean "like e.g. gettext", but whatever)


Note You need to log in before you can comment on or make changes to this bug.