zylishiyu/cmockery

gcc compiler warning: format not a string literal and no format arguments

Opened this issue · 0 comments

What steps will reproduce the problem?
1. Compile cmockery using gcc version 4.2.1.
2. Observe warning messages.

What is the expected output? 

No warnings

What do you see instead?

/Users/smb/src/cmockery-staging/osx/../src/cmockery.c: In function 
'vprint_message':
/Users/smb/src/cmockery-staging/osx/../src/cmockery.c:1550: warning: format not 
a string 
literal and no format arguments
/Users/smb/src/cmockery-staging/osx/../src/cmockery.c: In function 
'vprint_error':
/Users/smb/src/cmockery-staging/osx/../src/cmockery.c:1561: warning: format not 
a string 
literal and no format arguments


What version of the product are you using? On what operating system?

cmockery tip on Mac OS 10.6.2 using Xcode 3.2.1, also on CentOS 5.4 wtih gcc 
(GCC) 4.1.2 
20080704 (Red Hat 4.1.2-46)

Please provide any additional information below.

Trivially fixed by adding printf format string to the two printf and fprintf 
calls:

    printf("%s", buffer);

    fprintf(stderr, "%s", buffer);


Original issue reported on code.google.com by Stephen....@gmail.com on 1 Mar 2010 at 7:03