#18 Warnings when building with -Wstrict-prototypes

closed-fixed
nobody
None
5
2013-02-05
2012-01-03
No

The automake buildscripts I'm using needs to use the flags -Wstrict-prototypes and -Werror as the company I work for requires this.

As a simple example, the following will not compile:
gcc cJSON.c test.c -o JSONTest -lm -Wstrict-prototypes -Werror

The given errors are all the same "error: function declaration isn’t a prototype"

The problem is functions looking like:
void func();
when they should be declared as:
void func(void);

In C:
void func() means "a function func taking an unspecified number of arguments of unspecified type"
void func(void) means "a function func taking no arguments"

In C++:
void func() means "a function func taking no arguments"
void func(void) means "a function func taking no arguments"

I'm hoping I will be able to use cJSON with gcc since is seems perfect for our needs.
Thanks for an otherwise great lib!

Discussion

  • Roger Sunesson

    Roger Sunesson - 2012-01-04
    • summary: Warnings when buiding with -Wstrict-prototypes --> Warnings when building with -Wstrict-prototypes
     
  • Dave Gamble

    Dave Gamble - 2013-02-05

    Fixed in SVN.

     
  • Dave Gamble

    Dave Gamble - 2013-02-05
    • status: open --> closed-fixed
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks