lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master 3f80558d 4/6: Explain why several clang warni


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 3f80558d 4/6: Explain why several clang warnings are disabled
Date: Sun, 10 Jul 2022 12:07:57 -0400 (EDT)

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

    Explain why several clang warnings are disabled
    
    '-Wextra-semi-stmt' warns in only two circumstances in lmi:
     - Deliberate null statements, often marked "// Do nothing."
     - Pleonastic terminal semicolons on function-like macro invocations.
       The "do {} while(0)" trick would prevent the warning, but it's not
       reasonable to require it.
    Both these uses are legitimate. In no case is the warning useful.
    Oddly, it doesn't warn about stray semicolons elsewhere; even adding
    an explicit '-Wextra-semi' doesn't warn about them, although gcc's
    '-Wpedantic' does.
    
    '-Wmissing-prototypes' and '-Wmissing-variable-declarations' both seem
    only to flag entities that might be enclosed in an unnamed namespace,
    but generally shouldn't be.
---
 compiler_clang_warnings.make | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/compiler_clang_warnings.make b/compiler_clang_warnings.make
index 55447009..722185b2 100644
--- a/compiler_clang_warnings.make
+++ b/compiler_clang_warnings.make
@@ -60,15 +60,15 @@ clang_c_warnings := \
 # -Wdocumentation-unknown-command: warns about comments
 # -Wdouble-promotion: not actually useful
 # -Wexit-time-destructors: for analysis only--all positives are false
-###  -Wextra-semi-stmt
+# -Wextra-semi-stmt: all positives are false
 # -Wfloat-conversion: false positives for double-to-bool conversion
 # -Wfloat-equal: too many false positives, e.g., 0.0 == X
 # -Wglobal-constructors: for analysis only--all positives are false
 # -Wlogical-op-parentheses: && is multiplicative; || is additive
 # -Wmismatched-tags: stylistic freedom--not a defect
 # -Wmissing-noreturn: use occasionally; beware false positives
-###  -Wmissing-prototypes
-###  -Wmissing-variable-declarations
+# -Wmissing-prototypes: inappropriate for C++
+# -Wmissing-variable-declarations: inappropriate for C++
 # -Wpadded: useful only for low-level work
 # -Wsign-conversion: too many false positives, e.g., v[signed]
 # -Wstring-plus-int: false negatives and no true positives in lmi



reply via email to

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