[cmake-developers] [PATCH v3 2/7] Deprecate const char* SystemTools::GetEnv function
Dāvis Mosāns
davispuh at gmail.com
Wed Jul 6 15:12:08 EDT 2016
On Windows this function returns environment variable encoded
in ANSI codepage which might not match internally used encoding.
---
Source/kwsys/SystemTools.hxx.in | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/Source/kwsys/SystemTools.hxx.in b/Source/kwsys/SystemTools.hxx.in
index c9b18b7..51fb206 100644
--- a/Source/kwsys/SystemTools.hxx.in
+++ b/Source/kwsys/SystemTools.hxx.in
@@ -26,6 +26,16 @@
# include <unistd.h> // For access permissions for use with access()
#endif
+#if __cplusplus >= 201402L
+# define DEPRECATED [[deprecated]]
+#elif defined(__GNUC__)
+# define DEPRECATED __attribute__ ((deprecated))
+#elif defined(_MSC_VER)
+# define DEPRECATED __declspec(deprecated)
+#else
+# define DEPRECATED
+#endif
+
// Required for va_list
#include <stdarg.h>
// Required for FILE*
@@ -839,8 +849,8 @@ public:
/**
* Read an environment variable
*/
- static const char* GetEnv(const char* key);
- static const char* GetEnv(const std::string& key);
+ DEPRECATED static const char* GetEnv(const char* key);
+ DEPRECATED static const char* GetEnv(const std::string& key);
static bool GetEnv(const char* key, std::string& result);
static bool GetEnv(const std::string& key, std::string& result);
static bool HasEnv(const char* key);
--
2.9.0
More information about the cmake-developers
mailing list