From a766d1449c13f81495c7746965e153f28621e0e1 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Thu, 30 Nov 2017 22:30:04 +0000 Subject: [PATCH] Enable -Werror=writable-strings and fix one such error --- infrastructure/m4/boxbackup_tests.m4 | 1 + lib/common/Utils.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/infrastructure/m4/boxbackup_tests.m4 b/infrastructure/m4/boxbackup_tests.m4 index 4a44287a5..a2c6aac04 100644 --- a/infrastructure/m4/boxbackup_tests.m4 +++ b/infrastructure/m4/boxbackup_tests.m4 @@ -31,6 +31,7 @@ BOX_CHECK_CXX_FLAG(-Werror=parentheses) BOX_CHECK_CXX_FLAG(-Werror=undefined-bool-conversion) BOX_CHECK_CXX_FLAG(-Werror=unused-private-field) BOX_CHECK_CXX_FLAG(-Werror=overloaded-virtual) +BOX_CHECK_CXX_FLAG(-Werror=writable-strings) # This error is detected by MSVC, but not usually by GCC/Clang: # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58114 BOX_CHECK_CXX_FLAG(-Werror=delete-incomplete) diff --git a/lib/common/Utils.cpp b/lib/common/Utils.cpp index e851a1bd5..57a6651c0 100644 --- a/lib/common/Utils.cpp +++ b/lib/common/Utils.cpp @@ -384,7 +384,7 @@ std::string GetTempDirPath() } return std::string(buffer); #else - char* result = getenv("TMPDIR"); + const char* result = getenv("TMPDIR"); if(result == NULL) { result = getenv("TEMP");