سؤال

I have an Xcode project that I compile with Clang using some 3rd party library with Visual Studio C code.

In the 3rd party library anonymous structs are used in header files (I can't really change that). Thus I get this warning:

"myfile.h:47:17: Anonymous structs are a GNU extension"

As described here, I tried to pass "-fms-extensions" in the C flags of my Xcode project: http://clang.llvm.org/docs/UsersManual.html#microsoft-extensions

No luck. Any idea how to get rid of that warning?

هل كانت مفيدة؟

المحلول

Adding -Wno-microsoft did not work for me.

Using this small test program

typedef struct test_struct
{
  struct
  {
    int a;
    int b;
  };
  int x;
} Test;

int main(int argc, char **argv)
{
  Test test;
  test.a = 0;
}

using -Wno-gnu disables the warning

Version is Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)

نصائح أخرى

You can simply use -Wno-microsoft to hide the warning.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top