lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master adcaef29 06/17: Establish a framework for cla


From: Greg Chicares
Subject: [lmi-commits] [lmi] master adcaef29 06/17: Establish a framework for clang warnings
Date: Sat, 2 Jul 2022 21:42:14 -0400 (EDT)

branch: master
commit adcaef298aca9e059f6aca14bf7cb2f97bef7050
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>

    Establish a framework for clang warnings
---
 compiler_clang.make          |  4 ++--
 compiler_clang_warnings.make | 30 ++++++++++++++++++++++++++++++
 2 files changed, 32 insertions(+), 2 deletions(-)

diff --git a/compiler_clang.make b/compiler_clang.make
index 4305bb94..3bf6e19d 100644
--- a/compiler_clang.make
+++ b/compiler_clang.make
@@ -141,14 +141,14 @@ REQUIRED_COMPILER_FLAGS := \
 
 # C compiler flags.
 
-REQUIRED_CFLAGS = -std=c99 $(REQUIRED_COMPILER_FLAGS)
+REQUIRED_CFLAGS = -std=c99 $(C_WARNINGS) $(REQUIRED_COMPILER_FLAGS)
 
 # Better to leave this unset, and specify optimization elsewhere?
 CFLAGS = $(optimization_flag)
 
 # C++ compiler flags.
 
-REQUIRED_CXXFLAGS = -std=c++20 $(REQUIRED_COMPILER_FLAGS)
+REQUIRED_CXXFLAGS = -std=c++20 $(CXX_WARNINGS) $(REQUIRED_COMPILER_FLAGS)
 
 # Write '-Wno' options at the end, with a rationale here.
 #
diff --git a/compiler_clang_warnings.make b/compiler_clang_warnings.make
index 6aa26a34..a6583410 100644
--- a/compiler_clang_warnings.make
+++ b/compiler_clang_warnings.make
@@ -22,3 +22,33 @@
 # Don't remake this makefile.
 
 $(srcdir)/compiler_clang_warnings.make:: ;
+
+# Warnings for clang.
+
+clang_version_specific_c_warnings :=
+clang_version_specific_cxx_warnings :=
+
+treat_warnings_as_errors := -pedantic-errors -Werror
+
+clang_common_warnings := \
+  $(treat_warnings_as_errors) \
+
+clang_c_warnings := \
+  $(clang_common_warnings) \
+
+clang_cxx_warnings := \
+  $(clang_common_warnings) \
+
+# Keep version-specific warnings last, so that they override others.
+
+C_WARNINGS = \
+  $(clang_c_warnings) \
+  $(clang_common_extra_warnings) \
+  $(clang_version_specific_c_warnings) \
+
+CXX_WARNINGS = \
+  $(clang_cxx_warnings) \
+  $(clang_common_extra_warnings) \
+  $(clang_version_specific_cxx_warnings) \
+
+# This file does not end in backslash-newline.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]