lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master 45051a5 4/4: Avoid a gcc version discrepancy


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 45051a5 4/4: Avoid a gcc version discrepancy
Date: Thu, 30 Apr 2020 15:38:44 -0400 (EDT)

branch: master
commit 45051a5e916c75f537a98eb8e5a543f5795f7d0f
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>

    Avoid a gcc version discrepancy
    
    gcc-8 and gcc-9 expanded __LINE__ in macro LMI_LOCATION differently:
    gcc-9 used the physical line on which LMI_LOCATION occurred, while
    gcc-8 used the line number of the surrounding BOOST_TEST_THROW macro.
    Resolved the problem by omitting the location, which the testing
    framework ignores if it's not specified.
---
 assert_lmi_test.cpp | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/assert_lmi_test.cpp b/assert_lmi_test.cpp
index 76ca5b1..9ef1319 100644
--- a/assert_lmi_test.cpp
+++ b/assert_lmi_test.cpp
@@ -25,12 +25,6 @@
 
 #include "test_tools.hpp"
 
-#define SINGLY_STRINGIFY(Z) #Z
-#define DOUBLY_STRINGIFY(Z) SINGLY_STRINGIFY(Z)
-
-#define LMI_LOCATION \
-    "\n[assert_lmi_test.cpp : " DOUBLY_STRINGIFY(__LINE__) "]\n"
-
 int test_main(int, char*[])
 {
     LMI_ASSERT(true);
@@ -54,13 +48,13 @@ int test_main(int, char*[])
     BOOST_TEST_THROW
         (LMI_ASSERT_WITH_MSG(not_true,"<" << not_true << ">")
         ,std::runtime_error
-        ,"Assertion 'not_true' failed\n(<0>)." LMI_LOCATION
+        ,"Assertion 'not_true' failed\n(<0>)."
         );
 
     BOOST_TEST_THROW
         (LMI_ASSERT_EQUAL(not_true,true)
         ,std::runtime_error
-        ,"Assertion '(not_true) == (true)' failed\n(expected 1 vs observed 
0)." LMI_LOCATION
+        ,"Assertion '(not_true) == (true)' failed\n(expected 1 vs observed 0)."
         );
 
     // This test demonstrated a historical error: it failed to compile



reply via email to

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