Unverified Commit 81c3e0cf authored by Joshua Haberman's avatar Joshua Haberman Committed by GitHub

Merge pull request #5142 from noloader/master

Mostly fix Sun Studio configuration using SunCC compiler (GH #5141)
parents cb7678eb be14bf2b
...@@ -26,7 +26,7 @@ AC_DEFUN([ACX_CHECK_SUNCC],[ ...@@ -26,7 +26,7 @@ AC_DEFUN([ACX_CHECK_SUNCC],[
AS_IF([test "$SUNCC" = "yes" -a "x${ac_cv_env_CXXFLAGS_set}" = "x"],[ AS_IF([test "$SUNCC" = "yes" -a "x${ac_cv_env_CXXFLAGS_set}" = "x"],[
dnl Sun Studio has a crashing bug with -xO4 in some cases. Keep this dnl Sun Studio has a crashing bug with -xO4 in some cases. Keep this
dnl at -xO3 until a proper test to detect those crashes can be done. dnl at -xO3 until a proper test to detect those crashes can be done.
CXXFLAGS="-g0 -xO3 -xlibmil -xdepend -xbuiltin -mt -compat=5 -library=stlport4 -library=Crun -template=no%extdef ${CXXFLAGS}" CXXFLAGS="-g0 -xO3 -xlibmil -xdepend -xbuiltin -mt -template=no%extdef ${CXXFLAGS}"
]) ])
case $host_os in case $host_os in
...@@ -67,4 +67,7 @@ AC_DEFUN([ACX_CHECK_SUNCC],[ ...@@ -67,4 +67,7 @@ AC_DEFUN([ACX_CHECK_SUNCC],[
;; ;;
esac esac
AS_IF([test "$target_cpu" = "sparc" -a "x$SUNCC" = "xyes" ],[
CXXFLAGS="-xregs=no%appl ${CXXFLAGS}"
])
]) ])
...@@ -620,6 +620,7 @@ bool IsNull<FieldMetadata::kInlinedType>(const void* ptr) { ...@@ -620,6 +620,7 @@ bool IsNull<FieldMetadata::kInlinedType>(const void* ptr) {
void SerializeInternal(const uint8* base, void SerializeInternal(const uint8* base,
const FieldMetadata* field_metadata_table, const FieldMetadata* field_metadata_table,
int32 num_fields, io::CodedOutputStream* output) { int32 num_fields, io::CodedOutputStream* output) {
SpecialSerializer func = nullptr;
for (int i = 0; i < num_fields; i++) { for (int i = 0; i < num_fields; i++) {
const FieldMetadata& field_metadata = field_metadata_table[i]; const FieldMetadata& field_metadata = field_metadata_table[i];
const uint8* ptr = base + field_metadata.offset; const uint8* ptr = base + field_metadata.offset;
...@@ -646,9 +647,9 @@ void SerializeInternal(const uint8* base, ...@@ -646,9 +647,9 @@ void SerializeInternal(const uint8* base,
// Special cases // Special cases
case FieldMetadata::kSpecial: case FieldMetadata::kSpecial:
reinterpret_cast<SpecialSerializer>( func = reinterpret_cast<SpecialSerializer>(
const_cast<void*>(field_metadata.ptr))( const_cast<void*>(field_metadata.ptr));
base, field_metadata.offset, field_metadata.tag, func (base, field_metadata.offset, field_metadata.tag,
field_metadata.has_offset, output); field_metadata.has_offset, output);
break; break;
default: default:
...@@ -664,6 +665,7 @@ uint8* SerializeInternalToArray(const uint8* base, ...@@ -664,6 +665,7 @@ uint8* SerializeInternalToArray(const uint8* base,
uint8* buffer) { uint8* buffer) {
ArrayOutput array_output = {buffer, is_deterministic}; ArrayOutput array_output = {buffer, is_deterministic};
ArrayOutput* output = &array_output; ArrayOutput* output = &array_output;
SpecialSerializer func = nullptr;
for (int i = 0; i < num_fields; i++) { for (int i = 0; i < num_fields; i++) {
const FieldMetadata& field_metadata = field_metadata_table[i]; const FieldMetadata& field_metadata = field_metadata_table[i];
const uint8* ptr = base + field_metadata.offset; const uint8* ptr = base + field_metadata.offset;
...@@ -692,9 +694,9 @@ uint8* SerializeInternalToArray(const uint8* base, ...@@ -692,9 +694,9 @@ uint8* SerializeInternalToArray(const uint8* base,
io::ArrayOutputStream array_stream(array_output.ptr, INT_MAX); io::ArrayOutputStream array_stream(array_output.ptr, INT_MAX);
io::CodedOutputStream output(&array_stream); io::CodedOutputStream output(&array_stream);
output.SetSerializationDeterministic(is_deterministic); output.SetSerializationDeterministic(is_deterministic);
reinterpret_cast<SpecialSerializer>( func = reinterpret_cast<SpecialSerializer>(
const_cast<void*>(field_metadata.ptr))( const_cast<void*>(field_metadata.ptr));
base, field_metadata.offset, field_metadata.tag, func (base, field_metadata.offset, field_metadata.tag,
field_metadata.has_offset, &output); field_metadata.has_offset, &output);
array_output.ptr += output.ByteCount(); array_output.ptr += output.ByteCount();
} break; } break;
......
...@@ -338,7 +338,8 @@ struct ShutdownData { ...@@ -338,7 +338,8 @@ struct ShutdownData {
}; };
static void RunZeroArgFunc(const void* arg) { static void RunZeroArgFunc(const void* arg) {
reinterpret_cast<void (*)()>(const_cast<void*>(arg))(); void (*func)() = reinterpret_cast<void (*)()>(const_cast<void*>(arg));
func();
} }
void OnShutdown(void (*func)()) { void OnShutdown(void (*func)()) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment