Skip to content

Commit 77068aa

Browse files
Add DEPRECATED macro to mark deprecated functions and variables
1 parent 768e8a6 commit 77068aa

File tree

3 files changed

+28
-2
lines changed

3 files changed

+28
-2
lines changed

CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR
2222
# Ensure NDEBUG is not set for release builds
2323
set(CMAKE_CXX_FLAGS_RELEASE "-O2")
2424
# Enable lots of warnings
25-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wpedantic -Werror")
25+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wpedantic -Werror -Wno-error=deprecated-declarations")
2626
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
2727
# This would be the place to enable warnings for Windows builds, although
2828
# config.inc doesn't seem to do that currently

src/config.inc

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ BUILD_ENV = AUTO
55
ifeq ($(BUILD_ENV),MSVC)
66
#CXXFLAGS += /Wall /WX
77
else
8-
CXXFLAGS += -Wall -pedantic -Werror
8+
CXXFLAGS += -Wall -pedantic -Werror -Wno-error=deprecated-declarations
99
endif
1010

1111
# Select optimisation or debug info

src/util/deprecation.h

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*******************************************************************\
2+
3+
Module:
4+
5+
Author: Diffblue Ltd.
6+
7+
\*******************************************************************/
8+
9+
#ifndef CPROVER_UTIL_DEPRECATION_H
10+
#define CPROVER_UTIL_DEPRECATION_H
11+
12+
#if __cplusplus >= 201402L
13+
// C++14
14+
#define DEPRECATED(msg) [[deprecated(msg)]]
15+
#elif defined(__GNUC__)
16+
// GCC and GCC compatible compilers
17+
#define DEPRECATED(msg) __attribute__((deprecated(msg)))
18+
#elif defined(_MSC_VER)
19+
// Visual Studio
20+
#define DEPRECATED(msg) __declspec(deprecated(msg))
21+
#else
22+
// Compiler we don't know how to handle or that doesn't have deprecation support
23+
#define DEPRECATED(msg)
24+
#endif
25+
26+
#endif // CPROVER_UTIL_DEPRECATION_H

0 commit comments

Comments
 (0)