Apache OpenOffice (AOO) Bugzilla – Issue 23882
testtools linux sparc integer constant is too large for "long" type
Last modified: 2004-10-30 12:18:05 UTC
Building testtools on linux sparc cws_src680_ooo20031216 bridgetest.cxx:508: error: integer constant is too large for "long" type line 508 --> sal_Int64 _arHyper[] = {0x8000000000000000, 1, 0x7fffffffffffffff}; all the errors--> /home/jim/680/o2_src/testtools/source/bridgetest/bridgetest.cxx: In function `sal_Bool bridge_test::performTest(const com::sun::star::uno::Reference<com::sun::star::test::bridge::XBridgeTest>&)': /home/jim/680/o2_src/testtools/source/bridgetest/bridgetest.cxx:375: error: integer constant is too large for "long" type /home/jim/680/o2_src/testtools/source/bridgetest/bridgetest.cxx:375: error: integer constant is too large for "long" type /home/jim/680/o2_src/testtools/source/bridgetest/bridgetest.cxx:508: error: integer constant is too large for "long" type /home/jim/680/o2_src/testtools/source/bridgetest/bridgetest.cxx:508: error: integer constant is too large for "long" type /home/jim/680/o2_src/testtools/source/bridgetest/bridgetest.cxx:509: error: integer constant is too large for "long" type /home/jim/680/o2_src/testtools/source/bridgetest/bridgetest.cxx:535: error: integer constant is too large for "long" type /home/jim/680/o2_src/testtools/source/bridgetest/bridgetest.cxx:535: error: integer constant is too large for "long" type /home/jim/680/o2_src/testtools/source/bridgetest/bridgetest.cxx:539: error: integer constant is too large for "long" type /home/jim/680/o2_src/testtools/source/bridgetest/bridgetest.cxx:539: error: integer constant is too large for "long" type /home/jim/680/o2_src/testtools/source/bridgetest/bridgetest.cxx:543: error: integer constant is too large for "long" type /home/jim/680/o2_src/testtools/source/bridgetest/bridgetest.cxx:543: error: integer constant is too large for "long" type dmake: Error code 1, while making '../../unxlngs.pro/slo/bridgetest.obj' ---* TG_SLO.MK *--- ERROR: Error 65280 occurred while making /home/jim/680/o2_src/testtools/source/bridgetest jim@sun:~/680/o2_src/testtools$
from sal/inc/sal/types.h #define SAL_MIN_INT64 ((sal_Int64) -0x8000000000000000) #define SAL_MAX_INT64 ((sal_Int64) 0x7FFFFFFFFFFFFFFF)
Put this code and got the same error: sal_Int64 big = (SAL_MAX_INT64) ; it seems to think sal_Int64 is "long".
I put some "long" data where the testtools expects "long long" and it did build nicely and the test runs OK in cws_src680_ooo20031216, so i will take this issue away to porting. jim@sun:~/680/o2_src/testtools/unxlngs.pro/lib$ ./bridgetest_inprocess ### test succeeded!
looks like a compiler error. this code behaves as expected max + 1 --> negative max (overflow) but it complains the values are to large for "long" jim@sun:/usr/local/645/sal$ gcc -o type_test type_test.c type_test.c: In function `main': type_test.c:7: warning: integer constant is too large for "long" type type_test.c:8: warning: integer constant is too large for "long" type type_test.c:8: warning: integer overflow in expression type_test.c:9: warning: integer constant is too large for "long" type jim@sun:/usr/local/645/sal$ cat type_test.c #include <stdio.h> typedef long long sal_Int64; sal_Int64 bit64; #define SAL_MAX_INT64 ((sal_Int64) 0x7FFFFFFFFFFFFFFF) int main(void) { bit64 = SAL_MAX_INT64 ; printf("max + 1\t =\t%lld\n", SAL_MAX_INT64 + 1); printf("max - 1\t =\t %lld\n", SAL_MAX_INT64 - 1); printf("max\t =\t %lld, size = %d\n", bit64, sizeof(sal_Int64)); return(0); } jim@sun:/usr/local/645/sal$ ./type_test max + 1 = -9223372036854775808 max - 1 = 9223372036854775806 max = 9223372036854775807, size = 8 jim@sun:/usr/local/645/sal$
From: "Kevin B. Hendricks" <kevin.hendricks@sympatico.ca> Date: Fri, 26 Dec 2003 22:29:51 -0500 To: dev@porting.openoffice.org X-Mailer: Apple Mail (2.609) Subject: Re: [porting-dev] MacOSX now passes pyuno tests. Hi Jim, regarding testtools bridgetest ... I tried this on gcc 3.3 from Apple on a 32 bit MacOSX machine and got the same warning you got. Users/kbhend/ooo111a/testtools/source/bridgetest/bridgetest.cxx: In function `sal_Bool bridge_test::performTest(const com::sun::star::uno::Reference<com::sun::star::test::bridge:: XBridgeTest>&)': /Users/kbhend/ooo111a/testtools/source/bridgetest/bridgetest.cxx:338: warning: integer constant is too large for "long" type /Users/kbhend/ooo111a/testtools/source/bridgetest/bridgetest.cxx:338: warning: integer constant is too large for "long" type
Thats it - i put "ll" after those long long values in bridgetest.cxx and it builds OK. From: Ken Foskey <foskey@optushome.com.au> To: dev@porting.openoffice.org X-Mailer: Ximian Evolution 1.4.5 Date: Sat, 27 Dec 2003 15:02:11 +1100 Subject: Re: [porting-dev] MacOSX now passes pyuno tests. On Sat, 2003-12-27 at 14:47, Jim Watson wrote: > Thanks Kevin, > > I made issue 23882 for this. There i show how to store the > max value for a "long long" in a variable, and prove it is max by adding +1 > which returns negative max, still the compiler complains. So it may be a > compiler issue? There is a macro in sal/types.h that you should be using for this (Personally I think it is stupid, but...): typedef long long sal_Int64; typedef unsigned long long sal_uInt64; // The following are macros that will add the 64 bit constant suffix. # define SAL_CONST_INT64(x) x##ll # define SAL_CONST_UINT64(x) x##ull
In summary, it appears there is need to include sal/inc/sal/types.h and use those macros for long long constants. Otherwise the long long will not build on all platforms?
Created attachment 13046 [details] cd testtools; patch -P0 <
Created attachment 13796 [details] also needed for cppu/test
Approved. Please commit.
committed in cws_src680_ooo20040329 testtools/source/bridgetest/bridgetest.cxx cppu/test/test_di.cxx cppu/test/testcppu.cxx
Hi Jim, Looks good to me. Approved. Kevin
verified in m59 and closed