1

I am usually coding on OSX and compile all my program with : -Wall -Wextra -Werror

I download on another laptop nixos and when i want to compile the same project, i have -Wunused-result error.

I can disable it with : -Wno-unused-result but why this flag error appear on this os ?

I found nowhere a default flag configuration file or environment variable.

For curious the program i'm trying to compile is : libft.

1 Answer 1

1

If you're compiling on OSX and haven't installed gcc, Apple has provided clang pretending to be gcc. The pretense isn't very good, since there are a lot of differences in warnings (and exit-codes). You can see what you are running using

gcc --version

and (for instance ‐ I have installed gcc using MacPorts under /opt):

$ path -lL gcc
-rwxr-xr-x  3 root  admin  1131416 Jun 10  2016 /opt/local/bin/gcc
-rwxr-xr-x  1 root  wheel  18176 Jul  8 22:52 /usr/bin/gcc

$ /opt/local/bin/gcc --version
gcc (MacPorts gcc5 5.4.0_0) 5.4.0
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ /usr/bin/gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 8.0.0 (clang-800.0.42.1)
Target: x86_64-apple-darwin15.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

As you can see, /usr/bin/gcc is really clang, and (barring Apple improving things further), will produce similar messages.

1
  • This is why i wrote gcc / clang, i have the same error with both.
    – albttx
    Commented Dec 21, 2016 at 23:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.