Discussion:
[patch #9673] Use AX_COMPILER_VENDOR for more robust selection of compiler flags
John Zaitseff
2018-08-06 04:59:14 UTC
Permalink
URL:
<http://savannah.gnu.org/patch/?9673>

Summary: Use AX_COMPILER_VENDOR for more robust selection of
compiler flags
Project: GNU Autoconf Archive
Submitted by: zaitseff
Submitted on: Mon 06 Aug 2018 02:59:13 PM AEST
Priority: 5 - Normal
Status: None
Assigned to: None
Originator Email:
Open/Closed: Open
Discussion Lock: Any

_______________________________________________________

Details:

The AX_FLAGS_WARN_ALL macro is a very useful and simple one for adding
reasonable compiler warnings, as compared with the full machinery of
AX_COMPILER_FLAGS_CFLAGS and friends. It also works with multiple compilers,
unlike AX_COMPILER_FLAGS_CFLAGS which is tailored to GCC-emulating ones.

Unfortunately, AX_FLAGS_WARN_ALL uses a heuristic to determine which compiler
flags to use--and that heuristic fails on many compilers.

This series of patches reworks AX_FLAGS_WARN_ALL to use AX_COMPILER_VENDOR,
which is a far more robust way to select appropriate flags. All flags in the
old macro have been transferred across, with bug fixes added for current Intel
compilers. The patches depend on Patch #9671 to be applied first.

One function/file is added: AX_PREPEND_FLAG, which allows flags to be added to
the front of CFLAGS, etc., to allow the user to override AX_FLAGS_WARN_ALL's
selection.

I have tested this series of patches with my Star Traders game at
https://www.zap.org.au/software/trader -- see the Git repository at
https://www.zap.org.au/gitweb/trader.git .

If you prefer, I can combine all patches in this series into a single patch.



_______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Mon 06 Aug 2018 02:59:13 PM AEST Name:
0001-ax_cflags_warn_all.m4-Bump-version-number-and-add-ne.patch Size: 1KiB
By: zaitseff
Patches 1 to 4 of eight total
<http://savannah.gnu.org/patch/download.php?file_id=44721>
-------------------------------------------------------
Date: Mon 06 Aug 2018 02:59:13 PM AEST Name:
0002-ax_cflags_warn_all.m4-Rewrite-AX_FLAGS_WARN_ALL-to-u.patch Size: 5KiB
By: zaitseff
Patches 1 to 4 of eight total
<http://savannah.gnu.org/patch/download.php?file_id=44722>
-------------------------------------------------------
Date: Mon 06 Aug 2018 02:59:13 PM AEST Name:
0003-ax_cflags_warn_all.m4-Nicely-indent-remaining-macros.patch Size: 1KiB
By: zaitseff
Patches 1 to 4 of eight total
<http://savannah.gnu.org/patch/download.php?file_id=44723>
-------------------------------------------------------
Date: Mon 06 Aug 2018 02:59:13 PM AEST Name:
0004-ax_cflags_warn_all.m4-Rewrite-the-documentation-to-p.patch Size: 3KiB
By: zaitseff
Patches 1 to 4 of eight total
<http://savannah.gnu.org/patch/download.php?file_id=44724>

_______________________________________________________

Reply to this item at:

<http://savannah.gnu.org/patch/?9673>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
John Zaitseff
2018-08-06 05:00:07 UTC
Permalink
Additional Item Attachment, patch #9673 (project autoconf-archive):

File name: 0005-ax_cflags_warn_all.m4-Bug-fix-the-PGI-compilers-do-n.patch
Size:0 KB
File name: 0006-ax_cflags_warn_all.m4-Bug-fix-modern-Intel-compilers.patch
Size:0 KB
File name: 0007-ax_prepend_flag.m4-New-macro-AX_PREPEND_FLAG.patch Size:2 KB
File name: 0008-ax_cflags_warn_all.m4-Prepend-flags-instead-of-appen.patch
Size:1 KB


_______________________________________________________

Reply to this item at:

<http://savannah.gnu.org/patch/?9673>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
John Zaitseff
2018-08-06 05:08:39 UTC
Permalink
Follow-up Comment #1, patch #9673 (project autoconf-archive):

I have successfully tested this series of patches with the following
compilers:

* GCC 4.2.1, 4.4.7, 7.3.0, 8.2.0
* Clang (LLVM) 5.0.1, 6.0.0
* Portland PGI 18.3
* Intel C 18.03
* Sun (Solaris) Developer Studio 12.6


_______________________________________________________

Reply to this item at:

<http://savannah.gnu.org/patch/?9673>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
John Zaitseff
2018-08-06 10:27:01 UTC
Permalink
Follow-up Comment #2, patch #9673 (project autoconf-archive):

A ninth patch to avoid prepending empty flags ("") to CFLAGS et al.

(file #44731)
_______________________________________________________

Additional Item Attachment:

File name: 0009-ax_cflags_warn_all.m4-Avoid-prepending-empty-flags.patch
Size:2 KB


_______________________________________________________

Reply to this item at:

<http://savannah.gnu.org/patch/?9673>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/

Loading...