[Libreoffice] compile time verification of SAL_N_ELEMENTS and STRING_CONST foo

Caolán McNamara caolanm at redhat.com
Fri Dec 10 08:43:39 PST 2010


On Tue, 2010-12-07 at 13:04 +0000, Caolán McNamara wrote:
> On Tue, 2010-12-07 at 12:53 +0000, Noel Power wrote:
> > presumeably RTL_CONSTASCII_USTRINGPARAM would try to take sizeof( 
> > ConstAsciiString )  in that case
> 
> Soon enough I'll commit in a compile time test that will catch if that
> happens by accident. Though it can only be enabled with gcc 4.5.0 and
> above, but I compile with that so it'll get caught if it happens.

This test has now been in for a few days. The test requires c++0x
support with a particular language defect fix implemented. So configure
checks for it and enables c++0x support if it works with gcc and in
those cases SAL_N_ELEMENTS is checked to make sure its not applied to
the wrong type of arguments, and as a side effect the STRING_CONST get
checked as well.

In practice this only happens for gcc 4.5.0 onwards, but that's the
version I have, so I'm relatively confident that any potential future
accidents will be caught.

C.



More information about the LibreOffice mailing list