Skip to content

Commit

Permalink
Add DEPRECATED macro to mark deprecated functions and variables
Browse files Browse the repository at this point in the history
  • Loading branch information
hannes-steffenhagen-diffblue committed Apr 10, 2018
1 parent 768e8a6 commit 116fffd
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR
# Ensure NDEBUG is not set for release builds
set(CMAKE_CXX_FLAGS_RELEASE "-O2")
# Enable lots of warnings
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wpedantic -Werror")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wpedantic -Werror -Wno-error=deprecated-declarations")
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
# This would be the place to enable warnings for Windows builds, although
# config.inc doesn't seem to do that currently
Expand Down
2 changes: 1 addition & 1 deletion src/config.inc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ BUILD_ENV = AUTO
ifeq ($(BUILD_ENV),MSVC)
#CXXFLAGS += /Wall /WX
else
CXXFLAGS += -Wall -pedantic -Werror
CXXFLAGS += -Wall -pedantic -Werror -Wno-error=deprecated-declarations
endif

# Select optimisation or debug info
Expand Down
26 changes: 26 additions & 0 deletions src/util/deprecate.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*******************************************************************\
Module:
Author: Diffblue Ltd.
\*******************************************************************/

#ifndef CPROVER_UTIL_DEPRECATE_H
#define CPROVER_UTIL_DEPRECATE_H

#if __cplusplus >= 201402L
// C++14
#define DEPRECATED(msg) [[deprecated(msg)]]
#elif defined(__GNUC__)
// GCC and GCC compatible compilers
#define DEPRECATED(msg) __attribute__((deprecated(msg)))
#elif defined(_MSC_VER)
// Visual Studio
#define DEPRECATED(msg) __declspec(deprecated(msg))
#else
// Compiler we don't know how to handle or that doesn't have deprecation support
#define DEPRECATED(msg)
#endif

#endif // CPROVER_UTIL_DEPRECATE_H

0 comments on commit 116fffd

Please sign in to comment.