diff options
author | Mathias Preiner <mathias.preiner@gmail.com> | 2021-03-16 10:56:01 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-16 10:56:01 -0700 |
commit | d6890791897ddebf1212d3e3147bf7aeb2415b27 (patch) | |
tree | 51c69ba48a7550b6a7660e2488b4b39cbedba539 /src/parser | |
parent | 0d3ea6f2dcaf80d386c7765ee8a708c18e3ed574 (diff) |
cmake: Generate cvc4_export.h and set visibility to hidden. (#6139)
The build system (cmake) will automatically generate an export header
cvc4_export.h, which makes sure that the correct export features are
defined depending on the compiler and target platform. The macro CVC4_EXPORT
replaces CVC4_PUBLIC and its usage is reduced by 2/3.
Co-authored-by: Gereon Kremer <nafur42@gmail.com>
Diffstat (limited to 'src/parser')
-rw-r--r-- | src/parser/input.h | 18 | ||||
-rw-r--r-- | src/parser/parse_op.h | 2 | ||||
-rw-r--r-- | src/parser/parser.h | 10 | ||||
-rw-r--r-- | src/parser/parser_builder.h | 6 | ||||
-rw-r--r-- | src/parser/parser_exception.h | 11 |
5 files changed, 29 insertions, 18 deletions
diff --git a/src/parser/input.h b/src/parser/input.h index 10c53156e..f6be43028 100644 --- a/src/parser/input.h +++ b/src/parser/input.h @@ -19,12 +19,14 @@ #ifndef CVC4__PARSER__INPUT_H #define CVC4__PARSER__INPUT_H -#include <iostream> #include <stdio.h> + +#include <iostream> #include <string> #include <vector> #include "api/cvc4cpp.h" +#include "cvc4_export.h" #include "options/language.h" #include "parser/parser_exception.h" @@ -34,14 +36,15 @@ class Command; namespace parser { -class CVC4_PUBLIC InputStreamException : public Exception { +class InputStreamException : public Exception +{ public: InputStreamException(const std::string& msg); }; /** Wrapper around an input stream. */ -class CVC4_PUBLIC InputStream { - +class InputStream +{ /** The name of this input stream. */ std::string d_name; @@ -66,7 +69,7 @@ class CVC4_PUBLIC InputStream { /** Get the name of this input stream. */ const std::string getName() const; -};/* class InputStream */ +}; /* class InputStream */ class Parser; @@ -76,7 +79,8 @@ class Parser; * for the given input language and attach it to an input source of the * appropriate type. */ -class CVC4_PUBLIC Input { +class CVC4_EXPORT Input +{ friend class Parser; // for parseError, parseCommand, parseExpr friend class ParserBuilder; @@ -170,7 +174,7 @@ class CVC4_PUBLIC Input { /** Set the Parser object for this input. */ virtual void setParser(Parser& parser) = 0; -};/* class Input */ +}; /* class Input */ }/* CVC4::parser namespace */ }/* CVC4 namespace */ diff --git a/src/parser/parse_op.h b/src/parser/parse_op.h index 762be1e36..e5de7c998 100644 --- a/src/parser/parse_op.h +++ b/src/parser/parse_op.h @@ -55,7 +55,7 @@ namespace CVC4 { * interpret this operator by converting the next parsed constant of type T2 to * an Array of type (Array T1 T2) over that constant. */ -struct CVC4_PUBLIC ParseOp +struct ParseOp { ParseOp(api::Kind k = api::NULL_EXPR) : d_kind(k) {} /** The kind associated with the parsed operator, if it exists */ diff --git a/src/parser/parser.h b/src/parser/parser.h index 7789fd148..c2fad6656 100644 --- a/src/parser/parser.h +++ b/src/parser/parser.h @@ -24,6 +24,7 @@ #include <string> #include "api/cvc4cpp.h" +#include "cvc4_export.h" #include "expr/kind.h" #include "expr/symbol_manager.h" #include "expr/symbol_table.h" @@ -56,7 +57,7 @@ enum DeclarationCheck { * Returns a string representation of the given object (for * debugging). */ -inline std::ostream& operator<<(std::ostream& out, DeclarationCheck check) CVC4_PUBLIC; +inline std::ostream& operator<<(std::ostream& out, DeclarationCheck check); inline std::ostream& operator<<(std::ostream& out, DeclarationCheck check) { switch(check) { case CHECK_NONE: @@ -84,7 +85,7 @@ enum SymbolType { * Returns a string representation of the given object (for * debugging). */ -inline std::ostream& operator<<(std::ostream& out, SymbolType type) CVC4_PUBLIC; +inline std::ostream& operator<<(std::ostream& out, SymbolType type); inline std::ostream& operator<<(std::ostream& out, SymbolType type) { switch(type) { case SYM_VARIABLE: @@ -101,7 +102,8 @@ inline std::ostream& operator<<(std::ostream& out, SymbolType type) { * name of the file, line number and column information, and in-scope * declarations. */ -class CVC4_PUBLIC Parser { +class CVC4_EXPORT Parser +{ friend class ParserBuilder; private: @@ -769,7 +771,7 @@ public: * c1, c2, c3 are digits from 0 to 7. */ std::vector<unsigned> processAdHocStringEsc(const std::string& s); -};/* class Parser */ +}; /* class Parser */ }/* CVC4::parser namespace */ }/* CVC4 namespace */ diff --git a/src/parser/parser_builder.h b/src/parser/parser_builder.h index 178bbc2d9..c5de761b8 100644 --- a/src/parser/parser_builder.h +++ b/src/parser/parser_builder.h @@ -21,6 +21,7 @@ #include <string> +#include "cvc4_export.h" #include "options/language.h" #include "parser/input.h" @@ -42,7 +43,8 @@ class Parser; * called any number of times on an instance and will generate a fresh * parser each time. */ -class CVC4_PUBLIC ParserBuilder { +class CVC4_EXPORT ParserBuilder +{ enum InputType { FILE_INPUT, LINE_BUFFERED_STREAM_INPUT, @@ -184,7 +186,7 @@ class CVC4_PUBLIC ParserBuilder { /** Set the parser to use the given logic string. */ ParserBuilder& withForcedLogic(const std::string& logic); -};/* class ParserBuilder */ +}; /* class ParserBuilder */ }/* CVC4::parser namespace */ }/* CVC4 namespace */ diff --git a/src/parser/parser_exception.h b/src/parser/parser_exception.h index 4c6341d43..8b6bd3b50 100644 --- a/src/parser/parser_exception.h +++ b/src/parser/parser_exception.h @@ -24,11 +24,13 @@ #include <sstream> #include "base/exception.h" +#include "cvc4_export.h" namespace CVC4 { namespace parser { -class CVC4_PUBLIC ParserException : public Exception { +class CVC4_EXPORT ParserException : public Exception +{ public: // Constructors ParserException() : d_filename(), d_line(0), d_column(0) {} @@ -74,9 +76,10 @@ class CVC4_PUBLIC ParserException : public Exception { std::string d_filename; unsigned long d_line; unsigned long d_column; -};/* class ParserException */ +}; /* class ParserException */ -class CVC4_PUBLIC ParserEndOfFileException : public ParserException { +class ParserEndOfFileException : public ParserException +{ public: // Constructors same as ParserException's @@ -94,7 +97,7 @@ class CVC4_PUBLIC ParserEndOfFileException : public ParserException { { } -};/* class ParserEndOfFileException */ +}; /* class ParserEndOfFileException */ }/* CVC4::parser namespace */ }/* CVC4 namespace */ |