The branch, limit-exported-symbol-name-length has been updated
via a9db028a3584c0e3064ecd748eca3cf90aadf1b3 (commit)
from f1b96c88faa082a78a988a778c1db2d52bc7605b (commit)
- Log -----------------------------------------------------------------
commit a9db028a3584c0e3064ecd748eca3cf90aadf1b3
Author: Christian Herdtweck <christian.herdtweck@xxxxxxxxxxxxx>
Date: Wed Oct 26 15:13:25 2016 +0200
Replace unconditional shortening of exported symbols with error
Unconditional shortening of names could easily lead to same symbols for long
functions that differ only in parameters.
-----------------------------------------------------------------------
Summary of changes:
codegen/main.cpp | 19 +++++++++++++++++--
1 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/codegen/main.cpp b/codegen/main.cpp
index 4cf4fe7..7271b22 100644
--- a/codegen/main.cpp
+++ b/codegen/main.cpp
@@ -143,6 +143,15 @@ struct parse_error : public std::runtime_error
{}
};
+struct error_name_too_long : public std::runtime_error
+{
+ error_name_too_long(const std::string &name)
+ : std::runtime_error("symbol name '" + name + "' too long for
serialization ("
+ +
boost::lexical_cast<std::string>(name.length()) + ">"
+ +
boost::lexical_cast<std::string>(BOOST_SERIALIZATION_MAX_KEY_SIZE-1) + ")")
+ {}
+};
+
//! get type by id
/*!
\return type name or empty string on error
@@ -225,11 +234,17 @@ struct t2n_procedure
std::string ret_classname() const
{
- return (name+mangled).substr(0, BOOST_SERIALIZATION_MAX_KEY_SIZE-5) +
"_res";
+ std::string result = name+mangled+"_res";
+ if (result.length() >= BOOST_SERIALIZATION_MAX_KEY_SIZE)
+ throw error_name_too_long(result);
+ return result;
}
std::string cmd_classname() const
{
- return (name+mangled).substr(0, BOOST_SERIALIZATION_MAX_KEY_SIZE-5) +
"_cmd";
+ std::string result = name+mangled+"_cmd";
+ if (result.length() >= BOOST_SERIALIZATION_MAX_KEY_SIZE)
+ throw error_name_too_long(result);
+ return result;
}
bool hasReturn() const {return !ret_type.isVoid();}
};
hooks/post-receive
--
C++ inter-process communication library
--
libt2n-git - see http://www.intra2net.com/en/developer/libt2n for details.
To unsubscribe send a mail to libt2n-git+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx
|