Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiler errors on macOS with Xcode 9.0 beta 5 #503

Closed
eyeplum opened this issue Aug 14, 2017 · 7 comments
Closed

Compiler errors on macOS with Xcode 9.0 beta 5 #503

eyeplum opened this issue Aug 14, 2017 · 7 comments

Comments

@eyeplum
Copy link

eyeplum commented Aug 14, 2017

When try to compile a project depends on civetweb with the clang embedded in Xcode 9.0 beta 5 on macOS, there are 2 new compiler errors:

/s2client-api/contrib/civetweb/src/civetweb.c:141:34: error: unknown warning group '-Wno-reserved-id-macro', ignored [-Werror,-Wunknown-warning-option]
#pragma clang diagnostic ignored "-Wno-reserved-id-macro"
                                 ^
/s2client-api/contrib/civetweb/src/civetweb.c:142:34: error: unknown warning group '-Wno-keyword-macro', ignored [-Werror,-Wunknown-warning-option]
#pragma clang diagnostic ignored "-Wno-keyword-macro"
                                 ^

These two errors were appearing as warnings when compiled with previous versions of the Xcode embedded clang.

As we have investigated in Blizzard/s2client-api#49, the errors are caused by two factors:

  1. We are suppressing two warnings which doesn't exist any more here
  2. A CMake configuration is adding the -pedantic-errors flag here

Maybe we can remove those two #pragmas since those warnings are not there anymore?

@eyeplum eyeplum changed the title Compiling errors on macOS with Xcode 9.0 beta 5 Compiler errors on macOS with Xcode 9.0 beta 5 Aug 14, 2017
@bel2125
Copy link
Member

bel2125 commented Aug 14, 2017

I tried to get rid of the same warnings in the unit test yesterday (99a76ac), but it seems to depend on compiler versions.
I'm already looking into this.

Do you have any idea when this warning disappeared - what version?

@eyeplum
Copy link
Author

eyeplum commented Aug 15, 2017

Both on Xcode 8 and Xcode 9 the compilers are saying they are unknown warning group.

I don't have Xcode 7 at hand, but I guess the warning flags should be there, because that's the version we added those flags.

@bel2125
Copy link
Member

bel2125 commented Aug 15, 2017

The problem is, I don't have any Xcode at hand right now, the tests run either on Travis or are done by contributors.

If this was required up to Xcode 7, a possible fix would be to check the clang version - I found here this would be 3.9 for Xcode 8, released September 2016. So the following check could work, but I can't test it

#if (__clang_major__ < 3) || ((__clang_major__ < 4) && (__clang_minor__ < 9))

Could you try if this helps?

The alternative, to completely drop it might cause warnings on Travis CI - I have to check it there.

By the way: It's possible to build without "warnings as errors" even with the current CMakeFile by setting CIVETWEB_ALLOW_WARNINGS. It's disabled by default, so Travis CI and AppVeyor build without warnings for selected compilers - currently mainly selected by Travis and AppVeyor. It seems not possible to build warning free for every compiler and every compiler version. Warning free on selected versions of selected compilers (and selected static source analysers) seems to be best in reach anyway.

@eyeplum
Copy link
Author

eyeplum commented Aug 15, 2017

I tried to modified those lines to the following:

#ifdef __clang__
#if (__clang_major__ < 3) || ((__clang_major__ < 4) && (__clang_minor__ < 9))
/* Avoid warnings for Xopen 7.00 and higher */
#pragma clang diagnostic ignored "-Wno-reserved-id-macro"
#pragma clang diagnostic ignored "-Wno-keyword-macro"
#endif
#endif

And now it builds without errors (tested with Xcode 8 and Xcode 9).

Thank you for the help!

@bel2125
Copy link
Member

bel2125 commented Aug 15, 2017

It seems this error came with Xcode 7 and is gone again with Xcode 8, so it could be something like

if (__clang_major__ == 3) && ((__clang_minor__ == 7) || (__clang_minor__ == 8))
/* Avoid warnings for Xcode 7. It seems it does no longer exist in Xcode 8 */
#pragma clang diagnostic ignored "-Wno-reserved-id-macro"
#pragma clang diagnostic ignored "-Wno-keyword-macro"
#endif
#endif

Also Travis CI seems to like it this way.

@eyeplum
Copy link
Author

eyeplum commented Aug 15, 2017

True, I tried this and it's also working.

@bel2125
Copy link
Member

bel2125 commented Aug 15, 2017

Ok, so it's fixed. Then let's close this issue.

@bel2125 bel2125 closed this as completed Aug 15, 2017
KevinCalderone pushed a commit to KevinCalderone/civetweb that referenced this issue Aug 16, 2017
hunyadi-dev pushed a commit to hunyadi-dev/civetweb that referenced this issue Dec 18, 2020
…ifiers

This closes civetweb#503.

Signed-off-by: Aldrin Piri <aldrin@apache.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants