lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master 8d4034b: Allow "std::size_t" iff "std::"-qual


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 8d4034b: Allow "std::size_t" iff "std::"-qualified
Date: Wed, 17 Feb 2021 15:36:39 -0500 (EST)

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

    Allow "std::size_t" iff "std::"-qualified
    
    * regex_test.cpp: Document how to write '\n' in a raw literal.
    * test_coding_rules.cpp: Complain about non-qualified "size_t".
---
 regex_test.cpp        |  2 +-
 test_coding_rules.cpp | 13 +++++++++++++
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/regex_test.cpp b/regex_test.cpp
index 14495e5..7886a33 100644
--- a/regex_test.cpp
+++ b/regex_test.cpp
@@ -152,7 +152,7 @@ bool contains_regex0(std::string const& regex)
 /// TR1, there seem to be only two viable options:
 ///  - use a vectorized approach such as this; or
 ///  - write regexen with
-///    - "[^\\n]" instead of '.', and
+///    - "[^\\n]" or R"([^\n])" instead of '.', and
 ///    - "\n" instead of '^' and '$' anchors
 ///    and prepend a '\n' sentry to the string to be searched (and
 ///    assert that all files end in '\n').
diff --git a/test_coding_rules.cpp b/test_coding_rules.cpp
index edf8171..1344445 100644
--- a/test_coding_rules.cpp
+++ b/test_coding_rules.cpp
@@ -605,6 +605,19 @@ void check_cxx(file const& f)
         }
     }
 
+    {
+    // See:
+    //   https://lists.nongnu.org/archive/html/lmi/2021-02/msg00023.html
+    static boost::regex const r(R"([^:s]size_t[^\n])");
+    if
+        (  boost::regex_search(f.data(), r)
+        && f.leaf_name() != "test_coding_rules.cpp"
+        )
+        {
+        complain(f, "contains unqualified 'size_t'.");
+        }
+    }
+
     // Tests above: C or C++. Tests below: C++ only.
     if(!f.is_of_phylum(e_cxx))
         {



reply via email to

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