AP_HAL: prevent some FastDelegate warnings

This commit is contained in:
Andrew Tridgell 2014-05-08 11:11:03 +10:00
parent 0991af86f3
commit 74227cd7f0
1 changed files with 4 additions and 4 deletions

View File

@ -176,7 +176,7 @@ inline OutputClass horrible_cast(const InputClass input){
// If the compile fails here, it means the compiler has peculiar // If the compile fails here, it means the compiler has peculiar
// unions which would prevent the cast from working. // unions which would prevent the cast from working.
typedef int ERROR_CantUseHorrible_cast[sizeof(InputClass)==sizeof(u) typedef int ERROR_CantUseHorrible_cast[sizeof(InputClass)==sizeof(u)
&& sizeof(InputClass)==sizeof(OutputClass) ? 1 : -1]; && sizeof(InputClass)==sizeof(OutputClass) ? 1 : -1] __attribute((unused));
u.in = input; u.in = input;
return u.out; return u.out;
} }
@ -292,7 +292,7 @@ struct SimplifyMemFunc {
GenericMemFuncType &bound_func) { GenericMemFuncType &bound_func) {
// Unsupported member function type -- force a compile failure. // Unsupported member function type -- force a compile failure.
// (it's illegal to have a array with negative size). // (it's illegal to have a array with negative size).
typedef char ERROR_Unsupported_member_function_pointer_on_this_compiler[N-100]; typedef char ERROR_Unsupported_member_function_pointer_on_this_compiler[N-100] __attribute((unused));
return 0; return 0;
} }
}; };
@ -778,7 +778,7 @@ public:
// Ensure that there's a compilation failure if function pointers // Ensure that there's a compilation failure if function pointers
// and data pointers have different sizes. // and data pointers have different sizes.
// If you get this error, you need to #undef FASTDELEGATE_USESTATICFUNCTIONHACK. // If you get this error, you need to #undef FASTDELEGATE_USESTATICFUNCTIONHACK.
typedef int ERROR_CantUseEvilMethod[sizeof(GenericClass *)==sizeof(function_to_bind) ? 1 : -1]; typedef int ERROR_CantUseEvilMethod[sizeof(GenericClass *)==sizeof(function_to_bind) ? 1 : -1] __attribute((unused));
m_pthis = horrible_cast<GenericClass *>(function_to_bind); m_pthis = horrible_cast<GenericClass *>(function_to_bind);
// MSVC, SunC++ and DMC accept the following (non-standard) code: // MSVC, SunC++ and DMC accept the following (non-standard) code:
// m_pthis = static_cast<GenericClass *>(static_cast<void *>(function_to_bind)); // m_pthis = static_cast<GenericClass *>(static_cast<void *>(function_to_bind));
@ -793,7 +793,7 @@ public:
// Ensure that there's a compilation failure if function pointers // Ensure that there's a compilation failure if function pointers
// and data pointers have different sizes. // and data pointers have different sizes.
// If you get this error, you need to #undef FASTDELEGATE_USESTATICFUNCTIONHACK. // If you get this error, you need to #undef FASTDELEGATE_USESTATICFUNCTIONHACK.
typedef int ERROR_CantUseEvilMethod[sizeof(UnvoidStaticFuncPtr)==sizeof(this) ? 1 : -1]; typedef int ERROR_CantUseEvilMethod[sizeof(UnvoidStaticFuncPtr)==sizeof(this) ? 1 : -1] __attribute((unused));
return horrible_cast<UnvoidStaticFuncPtr>(this); return horrible_cast<UnvoidStaticFuncPtr>(this);
} }
#endif // !defined(FASTDELEGATE_USESTATICFUNCTIONHACK) #endif // !defined(FASTDELEGATE_USESTATICFUNCTIONHACK)