[Aptitude-devel] Bug#1065435: aptitude: FTBFS on armhf and armel (probably -Werror=implicit-function-declaration related)
Steinar H. Gunderson
sesse at debian.org
Wed Mar 13 08:02:47 GMT 2024
On Mon, Mar 04, 2024 at 07:34:06PM +0100, Sven Joachim wrote:
> Not really, these arches now default to a 64-bit time_t and therefore
> you get the conflicting types (suseconds_t is a long int,
> __suseconds64_t a long long int). This has nothing to do with implicit
> function declarations.
It's a bit crazy that tv_usec changes type, it should be in [0,1000000)
no matter what tv_sec is:
struct timeval
{
#ifdef __USE_TIME_BITS64
__time64_t tv_sec; /* Seconds. */
__suseconds64_t tv_usec; /* Microseconds. */
#else
__time_t tv_sec; /* Seconds. */
__suseconds_t tv_usec; /* Microseconds. */
#endif
};
#endif
But the fix is straightforward, no? Just change the offending test to something like
CPPUNIT_ASSERT_EQUAL(static_cast<decltype(c.tv_usec)>(999999), c.tv_usec);
and it should work no matter what type c.tv_usec is. Or, if you prefer
brace-initialization (which would prevent you from ever writing in a too-big
value, like 999999999999999 or something):
CPPUNIT_ASSERT_EQUAL(decltype(c.tv_usec){999999}, c.tv_usec);
/* Steinar */
--
Homepage: https://www.sesse.net/
More information about the Aptitude-devel
mailing list