Suggestions for "ax_compiler_flags_cxxflags"

Xin Liu <[email protected]> Thu, 5 Nov 2020 16:10:18 +0800
Newsgroups gmane.comp.sysutils.autoconf.archive-maintainers
Message-ID <CAKR2wkPka5d_b9_yoMJAXYYcLAmTbraFp1K_uP44Zr7aZ7-rgA@mail.gmail.com>
--00000000000019f7a705b357a149
Content-Type: text/plain; charset="UTF-8"

Hi,
  we are currently using this macro to generate CXX_FLAGS for compiling.
  Something found during the work..

1. Many flags inside the macro is enabled already by
     -Wall -Wextra and list it inside the MACRO is redundant

e.g
``` -Wreturn-type
 -Warray-bounds
 -Wunused-but-set-variable
 -Wstrict-aliasing
 -Winit-self
-Warray-bounds
-Wsign-compare
-Wunused-but-set-variabl
-Warray-bounds
...
```
-Wformat=2  equivalent -Wformat-nonliteral

2.  The CXXFLAGS disabled some default WARNING options, e.g
-Wno-unused-parameter -Wno-missing-field-initializers
-Wno-overloaded-virtual
-fno-strict-aliasing

 Which should not be needed. if we want to disable it we could append it
apparently.

3.  The Warning FLAG ' -Wswitch-enum ' caused a lot trouble when we use
google protobuf

As protobuf will always generate

 protobuf::Type_INT_MAX_SENTINEL_DO_NOT_USE_:
protobuf::Type_INT_MIN_SENTINEL_DO_NOT_USE_:

And warning will be reported because this 2 enums are not specified in
SWITCH/CASE.


Is that possible for you to remove those flags(1.2.3) from this macro?
thanks in advance.


```

            -Wall dnl
            -Wextra dnl
            -Wundef dnl
            -Wwrite-strings dnl
            -Wpointer-arith dnl
            -Wmissing-declarations dnl
            -Wredundant-decls dnl
            -Wno-unused-parameter dnl
            -Wno-missing-field-initializers dnl
            -Wformat=2 dnl
            -Wcast-align dnl
            -Wformat-nonliteral dnl
            -Wformat-security dnl
            -Wsign-compare dnl
            -Wstrict-aliasing dnl
            -Wshadow dnl
            -Winline dnl
            -Wpacked dnl
            -Wmissing-format-attribute dnl
            -Wmissing-noreturn dnl
            -Winit-self dnl
            -Wredundant-decls dnl
            -Wmissing-include-dirs dnl
            -Wunused-but-set-variable dnl
            -Warray-bounds dnl
            -Wreturn-type dnl
            -Wno-overloaded-virtual dnl
            -Wswitch-enum dnl
            -Wswitch-default dnl

  ```

-- 

Best Regards,
Liu Xin

--00000000000019f7a705b357a149
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>Hi,</div><div>=C2=A0 we are currently using this macr=
o to generate CXX_FLAGS for compiling.</div><div>=C2=A0 Something found dur=
ing the work..</div><div><br></div><div>1. Many flags inside the macro is e=
nabled already by <br></div><div>=C2=A0=C2=A0=C2=A0=C2=A0 -Wall -Wextra and=
 list it inside the MACRO is redundant</div><div><br></div><div>e.g <br></d=
iv><div>``` -Wreturn-type <br>=C2=A0-Warray-bounds <br>=C2=A0-Wunused-but-s=
et-variable<br>=C2=A0-Wstrict-aliasing</div><div>=C2=A0-Winit-self</div><di=
v>-Warray-bounds <br></div><div>
-Wsign-compare</div><div>
-Wunused-but-set-variabl<code><br></code></div><div><code>-Warray-bounds</c=
ode>



</div><div>...<br>

</div><div>```</div><div>
-Wformat=3D2=C2=A0=20
equivalent=20


-Wformat-nonliteral

</div><div><br></div><div>2.=C2=A0 The CXXFLAGS disabled some default WARNI=
NG options, e.g<br></div><div>
            -Wno-unused-parameter -Wno-missing-field-initializers=C2=A0

</div><div>
            -Wno-overloaded-virtual=C2=A0 <br></div><div>-fno-strict-aliasi=
ng</div><div><br>

</div><div>=C2=A0Which should not be needed. if we want to disable it we co=
uld append it apparently.</div><div><br></div><div>3.=C2=A0 The Warning FLA=
G &#39;
-Wswitch-enum

&#39; caused a lot trouble when we use google protobuf</div><div>
 </div><div><br></div><div>As protobuf will always generate <br></div><div>
<pre class=3D"gmail-code gmail-highlight" lang=3D"cpp"><span id=3D"gmail-LC=
1" class=3D"gmail-line" lang=3D"cpp"><span class=3D"gmail-k"> </span><span =
class=3D"gmail-n">protobuf</span><span class=3D"gmail-o">::</span><span cla=
ss=3D"gmail-n">Type_INT_MAX_SENTINEL_DO_NOT_USE_</span><span class=3D"gmail=
-p">:</span></span>
<span id=3D"gmail-LC2" class=3D"gmail-line" lang=3D"cpp"> <span class=3D"gm=
ail-n">protobuf</span><span class=3D"gmail-o">::</span><span class=3D"gmail=
-n">Type_INT_MIN_SENTINEL_DO_NOT_USE_</span><span class=3D"gmail-p">:</span=
></span><br><br></pre><pre class=3D"gmail-code gmail-highlight" lang=3D"cpp=
">And warning will be reported because this 2 enums are not specified in SW=
ITCH/CASE.<br></pre></div><div><br></div><div>Is that possible for you to r=
emove those flags(1.2.3) from this macro? thanks in advance.</div><div><br>

</div><div><br></div><div>```</div><div>
<pre>            -Wall dnl
            -Wextra dnl
            -Wundef dnl
            -Wwrite-strings dnl
            -Wpointer-arith dnl
            -Wmissing-declarations dnl
            -Wredundant-decls dnl
            -Wno-unused-parameter dnl
            -Wno-missing-field-initializers dnl
            -Wformat=3D2 dnl
            -Wcast-align dnl
            -Wformat-nonliteral dnl
            -Wformat-security dnl
            -Wsign-compare dnl
            -Wstrict-aliasing dnl
            -Wshadow dnl
            -Winline dnl
            -Wpacked dnl
            -Wmissing-format-attribute dnl
            -Wmissing-noreturn dnl
            -Winit-self dnl
            -Wredundant-decls dnl
            -Wmissing-include-dirs dnl
            -Wunused-but-set-variable dnl
            -Warray-bounds dnl
            -Wreturn-type dnl
            -Wno-overloaded-virtual dnl
            -Wswitch-enum dnl
            -Wswitch-default dnl</pre>

</div><div>=C2=A0 ```<br></div><div><br>-- <br></div><div><br><div dir=3D"l=
tr" class=3D"gmail_signature" data-smartmail=3D"gmail_signature"><div dir=
=3D"ltr"><div>Best Regards,<br></div>Liu Xin<br></div></div></div></div>

--00000000000019f7a705b357a149--