Xcode 11.4 and Max 8 SDK Project settings in C

Chris Rolfe's icon

I wanted to share a solution/workaround for noisy Xcode warnings...

Importing Max C headers under the Max 8 SDK projects w/ Catalina and Xcode 11.4 generates a distracting number of compiler warnings:

20 x "This function declaration is not a prototype"

There's a clang pragma to suppress the warning. Wrap any Max header #include statements in main.c with the "-Wstrict-prototypes" option ignored:

// ignore C function prototype warnings
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wstrict-prototypes"
#include "ext.h"
#include "ext_obex.h"
#include "z_dsp.h"
#pragma clang diagnostic pop


One warning left: "Traditional headermap style is no longer supported." can be fixed by changing the project build setting:

Search paths:
"Always Search User Paths (Deprecated)" = NO // was: YES

If anyone spots something dubious, kindly post a note in this thread. Or perhaps the prototype warnings could be suppressed within the build .config file? I don't like to change the library source files though.

Enjoy!

Iain Duncan's icon

Oh man, thanks. I need to do this.

Ian C's icon

Thank you for this!!

In my experience, you can let Xcode fix "This function declaration is not a prototype" with its "Fix this" feature and all will be well. Is there any reason to avoid letting Xcode make the automatic fix?

jasch's icon

Alternately, you can just disable Strict Prototypes in Build Settings

cheers

/*j

Chris Rolfe's icon

@ Iancooley
re: "fix this"

I didn't think to try that.

Chris Rolfe's icon

re: "fix this" started offered to change Cycling74's headers.

Changing strict protype=no in XCode's build settings is equivalent the clang pragma(s).