Cannot build with Werror due to warnings in juce_linux_Threads.cpp


#1

Using juce 3.0.7-12-g0c1f2a6 on Ubuntu 14.04, compiler is gnu g++ 4.8.2.

When building, compiling fails here:

In file included from JuceLibraryCode/modules/juce_core/juce_core.cpp:206:0:
JuceLibraryCode/modules/juce_core/native/juce_linux_Threads.cpp: In function ‘void juce::swapUserAndEffectiveUser()’:
JuceLibraryCode/modules/juce_core/native/juce_linux_Threads.cpp:84:42: error: ignoring return value of ‘int setreuid(__uid_t, __uid_t)’, declared with attribute warn_unused_result [-Werror=unused-result]
     (void) setreuid (geteuid(), getuid());
JuceLibraryCode/modules/juce_core/native/juce_linux_Threads.cpp:85:42: error: ignoring return value of ‘int setregid(__gid_t, __gid_t)’, declared with attribute warn_unused_result [-Werror=unused-result]
     (void) setregid (getegid(), getgid());
cc1plus: all warnings being treated as errors

Build process does have -Werror to treat warnings as errors.  Workaround for now is to remove that compiler flag, or add -Wno-unused-result.


#2

That's why the code used (void) before the function calls, but I guess the compiler is smarter than that! Easy to add a workaround, I'll do that now..