# Attempt to enable all Warnings

**URL:** <https://forum.juce.com/t/attempt-to-enable-all-warnings/21920>\
**Category:** General JUCE discussion\
**Created:** [April 21, 2017, 9:13am UTC](https://forum.juce.com/t/attempt-to-enable-all-warnings/21920 "2017-04-21T09:13:10Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Xxav](https://avatars.discourse-cdn.com/v4/letter/x/e0b2c6/32.png) [@Xxav](https://forum.juce.com/u/Xxav)\
**Post date:** [April 21, 2017, 9:13am UTC](https://forum.juce.com/t/attempt-to-enable-all-warnings/21920/1 "2017-04-21T09:13:10Z")

</div>

Hi @juceDevs,

I come here because I have a question about warnings.  
Here is my situation, on the project I’m working on, we are trying to enable all possible warnings, with the optimistic objective (maybe too optimistic ^^) of having, one day, a project where all the warnings are activated and no warning is spotted by the compiler.  
But I am currently experiencing a problem with that, because some warnings flags a great number of warnings in my project and in Juce, and those warnings are all mixed together which makes it difficult to know if there is still warnings from the project I’m working on. I have, for example add the flag “-Wfloat-equal” and got 300 warnings from both projects combined \* sad \*.  
I do not know which warnings you are using in Juce framework, so it’s probable that some of the warning flags I try to add are no relevant in Juce framework.

So I’m wondering if there is any way to disable the warnings coming from Juce framework directly from Projucer ? So the solution generated would automatically display the warnings coming from non-Juce source files.

Thanks in advance for your time!  
Xav.

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [April 21, 2017, 9:22am UTC](https://forum.juce.com/t/attempt-to-enable-all-warnings/21920/2 "2017-04-21T09:22:28Z")

</div>

We go to great lengths to remove all warnings from our code, and use some pretty hardcore warning levels in our test builds. Certainly compared to most other libraries, we’re very very warning-free!

But that -Wfloat-equal one is really annoying because all the things it moans about are false alarms, and not mistakes, and I’ve personally never known the warning to catch any genuine problems. I guess that if people are going to use it we should wrap some pragmas to avoid it triggering in our code.

Was it just that one flag that caused problems?

---

<div class="post-metadata">

**Author:** ![Xxav](https://avatars.discourse-cdn.com/v4/letter/x/e0b2c6/32.png) [@Xxav](https://forum.juce.com/u/Xxav)\
**Post date:** [April 21, 2017, 9:49am UTC](https://forum.juce.com/t/attempt-to-enable-all-warnings/21920/3 "2017-04-21T09:49:59Z")

</div>

Thanks @jules for you answer 🙂

Actually, the first time, I have added the flag “-Weverything” on xcode, which enable all the warnings flags.  
This generated so much warning, it reachs xcode limits with more that 1000 warnings and, for some file, more than 200 warnings 😂

So I’m now adding a few flags at the time and see the ones that triggerring warnings in Juce Framework and in my project.  
Currently, on the flags I have activated, only two flags have generates warnings in Juce files : “-Wfloat-equal” and “-Wextra-semi”.  
I will post the complete list of the flags that trigger warnings in Juce framework on xcode when I will have finish to try them 😉

Is there a file listing the warnings flags that you are using in Juce framework? So people can match the warning level of their project to the level of Juce Framework.

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [April 21, 2017, 10:09am UTC](https://forum.juce.com/t/attempt-to-enable-all-warnings/21920/4 "2017-04-21T10:09:21Z")

</div>

Ah, thanks, I’ll take a look at the -Wextra-semi ones!

You can look at the flags we use in projects like the projucer, which will have a lot turned on.

---

<div class="post-metadata">

**Author:** ![Xxav](https://avatars.discourse-cdn.com/v4/letter/x/e0b2c6/32.png) [@Xxav](https://forum.juce.com/u/Xxav)\
**Post date:** [April 28, 2017, 4:19pm UTC](https://forum.juce.com/t/attempt-to-enable-all-warnings/21920/5 "2017-04-28T16:19:55Z")

</div>

Hi @jules,

As I said a week ago, I give you the list of warnings that I’ve tested.  
I have based myself on this document [https://clang.llvm.org/docs/DiagnosticsReference.html](https://clang.llvm.org/docs/DiagnosticsReference.html)  
Some of the warning I have tested may not be relevant with Clang on OSX, but I’ve tried them anyway, just to be sure.  
For your information, I’ve tested those flags on JUCE 4.3.0.

List of all the warning flags that doesn’t generate any warning in Juce :  
-Wall -Wextra -Wpedantic -Wconversion -Wunreachable-code -Weffc++ -Wabstract-vbase-init -Warc-repeated-use-of-weak -Warray-bounds-pointer-arithmetic -Wassign-enum -Watomic-properties -Wauto-import -Wbad-function-cast -Wc+±compat -Wc++11-compat -Wc++11-extensions -Wc++11-narrowing -Wc++11-compat-pedantic -Wc++11-long-long -Wc++1z-extensions -Wc++98-c++11-c++14-compat-pedantic -Wc++98-c++11-compat-pedantic -Wc11-extensions -Wcast-qual -Wchar-subscripts -Wclass-varargs -Wcomment -Wcomplex-component-init -Wconditional-uninitialized -Wconsumed -Wcstring-format-directive -Wcustom-atomic-properties -Wdelegating-ctor-cycles -Wdelete-non-virtual-dtor -Wdeprecated-implementations -Wdirect-ivar-access -Wdollar-in-identifier-extension -Wduplicate-enum -Wduplicate-method-arg -Wduplicate-method-match -Wempty-translation-unit -Wexplicit-ownership-type -Wextended-offsetof -Wflexible-array-extensions -Wfloat-conversion -Wformat-non-iso -Wfour-char-constants -Wgnu -Widiomatic-parentheses -Wignored-qualifiers -Wimplicit -Wimplicit-atomic-properties -Wimplicit-function-declaration -Wimplicit-retain-self -Wimport-preprocessor-directive-pedantic -Wincomplete-module -Winfinite-recursion -Wkeyword-macro -Wlanguage-extension-token -Wlong-long -Wloop-analysis -Wmain -Wmethod-signatures -Wmicrosoft -Wmismatched-tags -Wmissing-braces -Wmissing-field-initializers -Wmissing-method-return-type -Rmodule-build -Wmost -Wnested-anon-types -Wnewline-eof -Wnon-gcc -Wnon-modular-include-in-module -Wnon-virtual-dtor -Wnullability-extension -Wnullable-to-nonnull-conversion -Wobjc-interface-ivars -Wobjc-missing-property-synthesis -Wover-aligned -Woverlength-strings -Woverloaded-virtual -Woverriding-method-mismatch -Rpass -Rpass-analysis -Rpass-missed -Wpointer-arith -Wpragmas -Wreceiver-forward-class -Rremark-backend-plugin -Wreorder -Wreserved-user-defined-literal -Wretained-language-linkage -Rsanitize-address -Wselector -Wself-assign -Wself-move -Wsemicolon-before-method-body -Wshadow -Wshorten-64-to-32 -Wsign-compare -Wsign-conversion -Wsometimes-uninitialized -Wsource-uses-openmp -Wstatic-in-inline -Wstrict-prototypes -Wstring-conversion -Wsuper-class-method-mismatch -Wtautological-compare -Wthread-safety -Wthread-safety-beta -Wthread-safety-negative -Wthread-safety-verbose -Wuninitialized -Wunknown-pragmas -Wunnamed-type-template-args -Wunneeded-internal-declaration -Wunneeded-member-function -Wunreachable-code-aggressive -Wunsupported-dll-base-class-template -Wunused -Wunused-function -Wunused-macros -Wunused-member-function -Wunused-parameter -Wused-but-marked-unused -Wvariadic-macros -Wvector-conversion -Wvla -Wvla-extension -Wweak-template-vtables -Wzero-length-array

List of the warning flags that trigger warnings in Juce with the approximative number of warning generated:  
-Wbind-to-temporary-copy - 010  
-Wcast-align - 060  
-Wextra-semi - 024  
-Wcovered-switch-default - 050  
-Wdate-time - 002  
-Wdeprecated - 030  
-Wdisabled-macro-expansion - 018  
-Wdocumentation - 014  
-Wdocumentation-pedantic - 018  
-Wdocumentation-unknown-command - 017  
-Wfloat-equal - 234  
-Wheader-hygiene - 002  
-Wimplicit-fallthrough - 100  
-Wmissing-noreturn - 002  
-Wmissing-prototypes - 021  
-Wmissing-variable-declarations - 017  
-Wold-style-cast - too much to count : exceed the limit of 200 for some files  
-Wpacked - 060  
-Wpadded - too much to count : exceed the limit of 200 for some files and 1000 on the project  
-Wreserved-id-macro - 040  
-Wshift-sign-overflow - 003  
-Wstrict-selector-match - 005  
-Wswitch-enum - 060  
-Wundeclared-selector - 036  
-Wundef - too much to count : exceed the limit of 200 for some files  
-Wundefined-reinterpret-cast - 001  
-Wunused-exception-parameter - 001  
-Wweak-vtables - too much to count : exceed the limit of 200 for some files

I hope this will help you to enhance Juce quality.  
Thanks again for your time ! 🙂  
Xav.

---

<div class="post-metadata">

**Author:** ![nbacklund](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/nbacklund/32/2969_2.png) [@nbacklund](https://forum.juce.com/u/nbacklund)\
**Post date:** [January 18, 2019, 10:01am UTC](https://forum.juce.com/t/attempt-to-enable-all-warnings/21920/6 "2019-01-18T10:01:06Z")

</div>

I tried to enable all the Xcode warnings above by pasting them into the “Custom Xcode Flags” field in Projucer. But Xcode will refuse to open the project, saying that it’s unable to parse it.

Am I doing it wrong?

---

<div class="post-metadata">

**Author:** ![matthieu-brucher](https://avatars.discourse-cdn.com/v4/letter/m/a5b964/32.png) [@matthieu-brucher](https://forum.juce.com/u/matthieu-brucher)\
**Post date:** [January 18, 2019, 10:03am UTC](https://forum.juce.com/t/attempt-to-enable-all-warnings/21920/7 "2019-01-18T10:03:20Z")

</div>

Just don’t. There are contradicting flags in this mode (see discussions on clang ML).

---

<div class="post-metadata">

**Author:** ![nbacklund](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/nbacklund/32/2969_2.png) [@nbacklund](https://forum.juce.com/u/nbacklund)\
**Post date:** [January 18, 2019, 10:29am UTC](https://forum.juce.com/t/attempt-to-enable-all-warnings/21920/8 "2019-01-18T10:29:33Z")

</div>

Thanks!

So what is the recommended way to enable a reasonably strict level of compiler warnings in Xcode via Projucer? Or does “Just don’t” mean that I shouldn’t do it at all?

---

<div class="post-metadata">

**Author:** ![daniel](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/daniel/32/790_2.png) [@daniel](https://forum.juce.com/u/daniel)\
**Post date:** [January 18, 2019, 11:09am UTC](https://forum.juce.com/t/attempt-to-enable-all-warnings/21920/9 "2019-01-18T11:09:29Z")

</div>

Here is my list, that kept me safe so far:

```auto
-Werror 
-Wall 
-Wshadow 
-Wno-missing-field-initializers 
-Wshorten-64-to-32 
-Wstrict-aliasing 
-Wuninitialized 
-Wunused-parameter 
-Wconversion 
-Wsign-compare 
-Wint-conversion 
-Woverloaded-virtual 
-Wreorder 
-Wconstant-conversion 
-Wsign-conversion

```

Did I miss some important ones?

---

<div class="post-metadata">

**Author:** ![nbacklund](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/nbacklund/32/2969_2.png) [@nbacklund](https://forum.juce.com/u/nbacklund)\
**Post date:** [January 18, 2019, 12:08pm UTC](https://forum.juce.com/t/attempt-to-enable-all-warnings/21920/10 "2019-01-18T12:08:39Z")

</div>

> [@daniel](#):
>
> -Werror -Wall -Wshadow -Wno-missing-field-initializers -Wshorten-64-to-32 -Wstrict-aliasing -Wuninitialized -Wunused-parameter -Wconversion -Wsign-compare -Wint-conversion -Woverloaded-virtual -Wreorder -Wconstant-conversion -Wsign-conversion

Thank you, but how did you enable those? I tried pasting them in Projucer (Custom Xcode Flags), and still get the error:

**Project cannot be opened because the project file cannot be parsed.**

I’m on JUCE 5.4.1, Xcode 8.3.2

---

<div class="post-metadata">

**Author:** ![daniel](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/daniel/32/790_2.png) [@daniel](https://forum.juce.com/u/daniel)\
**Post date:** [January 18, 2019, 12:18pm UTC](https://forum.juce.com/t/attempt-to-enable-all-warnings/21920/11 "2019-01-18T12:18:48Z")

</div>

Hmm, I put it there, and it works for me:

 ![warnings](https://us1.discourse-cdn.com/flex026/uploads/juce/original/2X/9/9b76d05d196f0031f5871319359f2ac01e275a68.png)

I’m on XCode 9.4.1 (latest stable, even though Apple considers 10 stable, I beg to differ 🙂 )

---

<div class="post-metadata">

**Author:** ![nbacklund](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/nbacklund/32/2969_2.png) [@nbacklund](https://forum.juce.com/u/nbacklund)\
**Post date:** [January 18, 2019, 2:36pm UTC](https://forum.juce.com/t/attempt-to-enable-all-warnings/21920/12 "2019-01-18T14:36:57Z")

</div>

Well, you know what they say, a picture says more than a thousand words!  
I had pasted the flags into the wrong box! 😃

I pasted them into **Custom Xcode Flags** (under the separate Debug/Release targets) rather than **Extra Compiler Flags** …

Now everything works as expected, and I have a ton of warnings to fix 🙂

Thanks a lot!

---

<div class="post-metadata">

**Author:** ![daniel](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/daniel/32/790_2.png) [@daniel](https://forum.juce.com/u/daniel)\
**Post date:** [July 17, 2020, 11:12am UTC](https://forum.juce.com/t/attempt-to-enable-all-warnings/21920/13 "2020-07-17T11:12:04Z")

</div>

Just in case you missed it: there is now for a while a shortcut to enable a useful set of warnings via Projucer:

 ![warnings](https://us1.discourse-cdn.com/flex026/uploads/juce/original/2X/e/ea0dc65d79c3b4baa6f6b3fabbac2a912f42329f.png)
