-
Notifications
You must be signed in to change notification settings - Fork 274
Add deprecate macro #2037
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
hannes-steffenhagen-diffblue
merged 2 commits into
diffblue:develop
from
hannes-steffenhagen-diffblue:add_deprecate_macro
Apr 11, 2018
Merged
Add deprecate macro #2037
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,7 @@ Author: Romain Brenguier, [email protected] | |
#include <util/replace_expr.h> | ||
#include <util/refined_string_type.h> | ||
#include <util/constexpr.def> | ||
#include <util/deprecate.h> | ||
#include <solvers/refinement/string_constraint.h> | ||
|
||
/// Generation of fresh symbols of a given type | ||
|
@@ -351,6 +352,7 @@ class string_constraint_generatort final | |
/// \todo This function is underspecified, we do not compute the exact value | ||
/// but over approximate it. | ||
/// \deprecated This is Java specific and should be implemented in Java. | ||
DEPRECATED("This is Java specific and should be implemented in Java") | ||
exprt add_axioms_for_code_point_count(const function_application_exprt &f); | ||
|
||
/// Add axioms corresponding the String.offsetByCodePointCount java function | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ Author: Romain Brenguier, [email protected] | |
/// equals, equalsIgnoreCase, compareTo, hashCode, intern | ||
|
||
#include <solvers/refinement/string_constraint_generator.h> | ||
#include <util/deprecate.h> | ||
|
||
/// Equality of the content of two strings | ||
/// | ||
|
@@ -267,6 +268,7 @@ exprt string_constraint_generatort::add_axioms_for_compare_to( | |
/// \deprecated never tested | ||
/// \param f: function application with one string argument | ||
/// \return a string expression | ||
DEPRECATED("never tested") | ||
symbol_exprt string_constraint_generatort::add_axioms_for_intern( | ||
const function_application_exprt &f) | ||
{ | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ Author: Romain Brenguier, [email protected] | |
|
||
#include <solvers/refinement/string_refinement_invariant.h> | ||
#include <solvers/refinement/string_constraint_generator.h> | ||
#include <util/deprecate.h> | ||
|
||
/// Add axioms ensuring the result `res` corresponds to `s1` where we | ||
/// inserted `s2` at position `offset`. | ||
|
@@ -126,10 +127,11 @@ exprt string_constraint_generatort::add_axioms_for_insert( | |
} | ||
|
||
/// add axioms corresponding to the StringBuilder.insert(I) java function | ||
/// \deprecated | ||
/// \deprecated should convert the value to string and call insert | ||
/// \param f: function application with three arguments: a string, an | ||
/// integer offset, and an integer | ||
/// \return an expression | ||
DEPRECATED("should convert the value to string and call insert") | ||
exprt string_constraint_generatort::add_axioms_for_insert_int( | ||
const function_application_exprt &f) | ||
{ | ||
|
@@ -150,6 +152,7 @@ exprt string_constraint_generatort::add_axioms_for_insert_int( | |
/// \param f: function application with three arguments: a string, an | ||
/// integer offset, and a Boolean | ||
/// \return a new string expression | ||
DEPRECATED("should convert the value to string and call insert") | ||
exprt string_constraint_generatort::add_axioms_for_insert_bool( | ||
const function_application_exprt &f) | ||
{ | ||
|
@@ -190,6 +193,7 @@ exprt string_constraint_generatort::add_axioms_for_insert_char( | |
/// \param f: function application with three arguments: a string, an | ||
/// integer offset, and a double | ||
/// \return a string expression | ||
DEPRECATED("should convert the value to string and call insert") | ||
exprt string_constraint_generatort::add_axioms_for_insert_double( | ||
const function_application_exprt &f) | ||
{ | ||
|
@@ -211,6 +215,7 @@ exprt string_constraint_generatort::add_axioms_for_insert_double( | |
/// \param f: function application with three arguments: a string, an | ||
/// integer offset, and a float | ||
/// \return a new string expression | ||
DEPRECATED("should convert the value to string and call insert") | ||
exprt string_constraint_generatort::add_axioms_for_insert_float( | ||
const function_application_exprt &f) | ||
{ | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,7 @@ Author: Romain Brenguier, [email protected] | |
#include <util/pointer_predicates.h> | ||
#include <util/ssa_expr.h> | ||
#include <util/string_constant.h> | ||
#include <util/deprecate.h> | ||
|
||
string_constraint_generatort::string_constraint_generatort( | ||
const string_constraint_generatort::infot &info, | ||
|
@@ -581,6 +582,7 @@ exprt string_constraint_generatort::add_axioms_for_function_application( | |
/// \param f: function application with one argument, which is a string, | ||
/// or three arguments: string, integer offset and count | ||
/// \return a new string expression | ||
DEPRECATED("should use substring instead") | ||
exprt string_constraint_generatort::add_axioms_for_copy( | ||
const function_application_exprt &f) | ||
{ | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ Author: Romain Brenguier, [email protected] | |
|
||
#include <solvers/refinement/string_refinement_invariant.h> | ||
#include <solvers/refinement/string_constraint_generator.h> | ||
#include <util/deprecate.h> | ||
|
||
/// Add axioms stating that the returned expression is true exactly when the | ||
/// first string is a prefix of the second one, starting at position offset. | ||
|
@@ -97,6 +98,7 @@ exprt string_constraint_generatort::add_axioms_for_is_prefix( | |
/// \deprecated should use `string_length(s)==0` instead | ||
/// \param f: function application with a string argument | ||
/// \return a Boolean expression | ||
DEPRECATED("should use `string_length(s)==0` instead") | ||
exprt string_constraint_generatort::add_axioms_for_is_empty( | ||
const function_application_exprt &f) | ||
{ | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ Author: Romain Brenguier, [email protected] | |
#include <solvers/refinement/string_refinement_invariant.h> | ||
#include <solvers/refinement/string_constraint_generator.h> | ||
#include <util/simplify_expr.h> | ||
#include <util/deprecate.h> | ||
|
||
#include <cmath> | ||
#include <solvers/floatbv/float_bv.h> | ||
|
@@ -40,6 +41,7 @@ exprt string_constraint_generatort::add_axioms_from_int( | |
/// \deprecated should use add_axioms_from_int instead | ||
/// \param f: function application with one long argument | ||
/// \return a new string expression | ||
DEPRECATED("should use add_axioms_from_int instead") | ||
exprt string_constraint_generatort::add_axioms_from_long( | ||
const function_application_exprt &f) | ||
{ | ||
|
@@ -54,9 +56,10 @@ exprt string_constraint_generatort::add_axioms_from_long( | |
} | ||
|
||
/// Add axioms corresponding to the String.valueOf(Z) java function. | ||
/// \deprecated this is specific to Java | ||
/// \deprecated This is Java specific and should be implemented in Java instead | ||
/// \param f: function application with a Boolean argument | ||
/// \return a new string expression | ||
DEPRECATED("This is Java specific and should be implemented in Java instead") | ||
exprt string_constraint_generatort::add_axioms_from_bool( | ||
const function_application_exprt &f) | ||
{ | ||
|
@@ -68,10 +71,11 @@ exprt string_constraint_generatort::add_axioms_from_bool( | |
|
||
/// Add axioms stating that the returned string equals "true" when the Boolean | ||
/// expression is true and "false" when it is false. | ||
/// \deprecated This is language dependent | ||
/// \deprecated This is Java specific and should be implemented in Java instead | ||
/// \param res: string expression for the result | ||
/// \param b: Boolean expression | ||
/// \return code 0 on success | ||
DEPRECATED("This is Java specific and should be implemented in Java instead") | ||
exprt string_constraint_generatort::add_axioms_from_bool( | ||
const array_string_exprt &res, | ||
const exprt &b) | ||
|
@@ -200,6 +204,7 @@ exprt string_constraint_generatort::int_of_hex_char(const exprt &chr) | |
/// \param res: string expression for the result | ||
/// \param i: an integer argument | ||
/// \return code 0 on success | ||
DEPRECATED("use add_axioms_from_int which takes a radix argument instead") | ||
exprt string_constraint_generatort::add_axioms_from_int_hex( | ||
const array_string_exprt &res, | ||
const exprt &i) | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,17 +14,21 @@ Author: Daniel Kroening, [email protected] | |
#include "optional.h" | ||
#include "invariant.h" | ||
|
||
#include "deprecate.h" | ||
|
||
class exprt; | ||
class constant_exprt; | ||
class typet; | ||
|
||
// this one will go away | ||
// returns 'true' on error | ||
/// \deprecated: use the constant_exprt version instead | ||
DEPRECATED("Use the constant_exprt version instead") | ||
bool to_integer(const exprt &expr, mp_integer &int_value); | ||
|
||
// returns 'true' on error | ||
/// \deprecated: use numeric_cast<mp_integer> instead | ||
DEPRECATED("Use numeric_cast<mp_integer> instead") | ||
bool to_integer(const constant_exprt &expr, mp_integer &int_value); | ||
|
||
// returns 'true' on error | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ Author: Daniel Kroening, [email protected] | |
|
||
#include "big-int/bigint.hh" | ||
#include "optional.h" | ||
#include "deprecate.h" | ||
|
||
// NOLINTNEXTLINE(readability/identifiers) | ||
typedef BigInt mp_integer; | ||
|
@@ -52,12 +53,15 @@ const std::string integer2binary(const mp_integer &, std::size_t width); | |
const mp_integer binary2integer(const std::string &, bool is_signed); | ||
|
||
/// \deprecated use numeric_cast<unsigned long long> instead | ||
DEPRECATED("Use numeric_cast<unsigned long long> instead") | ||
mp_integer::ullong_t integer2ulong(const mp_integer &); | ||
|
||
/// \deprecated use numeric_cast<std::size_t> instead | ||
DEPRECATED("Use numeric_cast<std::size_t> instead") | ||
std::size_t integer2size_t(const mp_integer &); | ||
|
||
/// \deprecated use numeric_cast<unsigned> instead | ||
DEPRECATED("Use numeric_cast<unsigned> instead") | ||
unsigned integer2unsigned(const mp_integer &); | ||
|
||
const mp_integer mp_zero=string2integer("0"); | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Am I right when saying that some bits are marked deprecated here when really they just need to get onto someone's task list to fix?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mainly wrote this to make it easier to fix code that uses deprecated functionality as we go and to prevent people from writing new code with deprecated functionality, but if someone took the time to fix all of the instances where those are used that would of course also be helpful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is correctly marked deprecated but the message is not totally clear: instead of calling this function we can obtain the same result by using calls to
add_axioms_from_boolean
andadd_axioms_for_insert
.