Skip Menu |

This queue is for tickets about the Syntax-Highlight-Universal CPAN distribution.

Report information
The Basics
Id: 63095
Status: open
Priority: 0/
Queue: Syntax-Highlight-Universal

People
Owner: Nobody in particular
Requestors: dci2112 [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Re: Ver 0.5 GCC Compile errors: solved
Date: Wed, 17 Nov 2010 13:12:49 -0500
To: bug-Syntax-Highlight-Universal [...] rt.cpan.org
From: douglas irvine <dci2112 [...] gmail.com>
* Issue => Compile Errors: CachingHRCParser.cpp: In member function ‘virtual void CachingHRCParser::loadFileType(FileType*)’: CachingHRCParser.cpp:32: error: cast from ‘SchemeImpl*’ to ‘int’ loses precision colorer/unicode/BitArray.cpp: In destructor ‘BitArray::~BitArray()’: colorer/unicode/BitArray.cpp:11: error: cast from ‘int*’ to ‘int’ loses precision colorer/unicode/BitArray.cpp: In member function ‘void BitArray::setBit(int)’: colorer/unicode/BitArray.cpp:20: error: cast from ‘int*’ to ‘int’ loses precision colorer/unicode/BitArray.cpp: In member function ‘void BitArray::clearBit(int)’: colorer/unicode/BitArray.cpp:25: error: cast from ‘int*’ to ‘int’ loses precision colorer/unicode/BitArray.cpp: In member function ‘void BitArray::addRange(int, int)’: colorer/unicode/BitArray.cpp:29: error: cast from ‘int*’ to ‘int’ loses precision colorer/unicode/BitArray.cpp: In member function ‘void BitArray::clearRange(int, int)’: colorer/unicode/BitArray.cpp:52: error: cast from ‘int*’ to ‘int’ loses precision colorer/unicode/BitArray.cpp: In member function ‘void BitArray::addBitArray(BitArray*)’: colorer/unicode/BitArray.cpp:73: error: cast from ‘int*’ to ‘int’ loses precision colorer/unicode/BitArray.cpp:75: error: cast from ‘int*’ to ‘int’ loses precision colorer/unicode/BitArray.cpp: In member function ‘void BitArray::clearBitArray(BitArray*)’: colorer/unicode/BitArray.cpp:86: error: cast from ‘int*’ to ‘int’ loses precision colorer/unicode/BitArray.cpp:87: error: cast from ‘int*’ to ‘int’ loses precision colorer/unicode/BitArray.cpp: In member function ‘void BitArray::intersectBitArray(BitArray*)’: colorer/unicode/BitArray.cpp:102: error: cast from ‘int*’ to ‘int’ loses precision colorer/unicode/BitArray.cpp:103: error: cast from ‘int*’ to ‘int’ loses precision colorer/unicode/BitArray.cpp: In member function ‘void BitArray::addBitArray(char*, int)’: colorer/unicode/BitArray.cpp:110: error: cast from ‘int*’ to ‘int’ loses precision colorer/unicode/BitArray.cpp: In member function ‘void BitArray::clearBitArray(char*, int)’: colorer/unicode/BitArray.cpp:117: error: cast from ‘int*’ to ‘int’ loses precision colorer/unicode/BitArray.cpp: In member function ‘bool BitArray::getBit(int)’: colorer/unicode/BitArray.cpp:124: error: cast from ‘int*’ to ‘int’ loses precision colorer/unicode/Encodings.cpp: In static member function ‘static int Encodings::getEncodingIndex(const char*)’: colorer/unicode/Encodings.cpp:48: error: ‘stricmp’ was not declared in this scope Solution: 1) use #include <inttypes.h> and (intptr_t) for all casting issues: i.e. int pos = (intptr_t)f->baseScheme; instead of int pos = (int)f->baseScheme; 2) Fix lack of stricmp by replacing __unix__ with __GNUC__ in colorer/unicode/String.h and String.cpp, and including #include <unicode/String.h> in colorer/unicode/Encodings.cpp GCC version:* Show quoted text
> gcc -v
Using built-in specs. Target: i686-apple-darwin10 Configured with: /var/tmp/gcc/gcc-5664~105/src/configure --disable-checking --enable-werror --prefix=/usr --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin10 --program-prefix=i686-apple-darwin10- --host=x86_64-apple-darwin10 --target=i686-apple-darwin10 --with-gxx-include-dir=/include/c++/4.2.1 Thread model: posix gcc version 4.2.1 (Apple Inc. build 5664) *Perl Version* Show quoted text
> perl -V
Summary of my perl5 (revision 5 version 8 subversion 9) configuration: Platform: osname=darwin, osvers=10.4.0, archname=darwin-2level uname='darwin susan.local 10.4.0 darwin kernel version 10.4.0: fri apr 23 18:28:53 pdt 2010; root:xnu-1504.7.4~1release_i386 i386 ' config_args='-des -D prefix=/opt/local -D scriptdir=/opt/local/bin -D cppflags=-I/opt/local/include -D ccflags=-pipe -O2 -arch x86_64 -D ldflags=-L/opt/local/lib -arch x86_64 -D vendorprefix=/opt/local -D man1ext=1pm -D man3ext=3pm -D cc=/usr/bin/gcc-4.2 -D ld=/usr/bin/gcc-4.2 -D man1dir=/opt/local/share/man/man1p -D man3dir=/opt/local/share/man/man3p -D siteman1dir=/opt/local/share/man/man1 -D siteman3dir=/opt/local/share/man/man3 -D vendorman1dir=/opt/local/share/man/man1 -D vendorman3dir=/opt/local/share/man/man3 -D inc_version_list=5.8.8 5.8.8/darwin-2level -U i_bind -U i_gdbm -U i_db' hint=recommended, useposix=true, d_sigaction=define usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=define use64bitall=define uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='/usr/bin/gcc-4.2', ccflags ='-pipe -O2 -arch x86_64 -fno-common -DPERL_DARWIN -I/opt/local/include -no-cpp-precomp -fno-strict-aliasing -I/usr/local/include -I/opt/local/include', optimize='-O3', cppflags='-I/opt/local/include -no-cpp-precomp -pipe -O2 -arch x86_64 -fno-common -DPERL_DARWIN -I/opt/local/include -no-cpp-precomp -fno-strict-aliasing -I/usr/local/include -I/opt/local/include' ccversion='', gccversion='4.2.1 (Apple Inc. build 5664)', gccosandvers='' intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16 ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='env MACOSX_DEPLOYMENT_TARGET=10.3 /usr/bin/gcc-4.2', ldflags ='-L/opt/local/lib -arch x86_64 -L/usr/local/lib' libpth=/usr/local/lib /opt/local/lib /usr/lib libs=-ldbm -ldl -lm -lutil -lc perllibs=-ldl -lm -lutil -lc libc=/usr/lib/libc.dylib, so=dylib, useshrplib=false, libperl=libperl.a gnulibc_version='' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' ' cccdlflags=' ', lddlflags='-L/opt/local/lib -arch x86_64 -bundle -undefined dynamic_lookup -L/usr/local/lib' Characteristics of this binary (from libperl): Compile-time options: PERL_MALLOC_WRAP USE_64_BIT_ALL USE_64_BIT_INT USE_FAST_STDIO USE_LARGE_FILES USE_PERLIO Built under darwin Compiled at Oct 1 2010 19:42:44 %ENV: PERL5LIB="/perl-5.8.2/lib:/perl-5.8.2/lib/perl5:/perl-5.8.2/lib/site_perl:" @INC: /perl-5.8.2/lib /perl-5.8.2/lib/perl5 /perl-5.8.2/lib/site_perl /opt/local/lib/perl5/site_perl/5.8.9/darwin-2level /opt/local/lib/perl5/site_perl/5.8.9 /opt/local/lib/perl5/site_perl /opt/local/lib/perl5/vendor_perl/5.8.9/darwin-2level /opt/local/lib/perl5/vendor_perl/5.8.9 /opt/local/lib/perl5/vendor_perl /opt/local/lib/perl5/5.8.9/darwin-2level /opt/local/lib/perl5/5.8.9 .

Message body is not shown because it is too large.

On Wed Nov 17 13:12:59 2010, dci2112@gmail.com wrote: Show quoted text
> * > Issue => > Compile Errors: > > CachingHRCParser.cpp: In member function ‘virtual void > CachingHRCParser::loadFileType(FileType*)’: > CachingHRCParser.cpp:32: error: cast from ‘SchemeImpl*’ to ‘int’ loses > precision > ... > Solution: > > 1) use #include <inttypes.h> and (intptr_t) for all casting issues: > > i.e. > int pos = (intptr_t)f->baseScheme; > > instead of > int pos = (int)f->baseScheme;
Following the above step fixed made the compile work. I had to edit 2 files, CachingHRCParser.cpp and colorer/unicode/BitArray.cpp. -Naveed
In addition to the already mentioned compile errors I had to fix several errors as shown below. Complete Gentoo/Sabayon Linux build log is attached. colorer/xml/xmldom.cpp: In member function ‘Document* DocumentBuilder::parse(const byte*, int, const char*)’: colorer/xml/xmldom.cpp:34:34: error: taking address of temporary [-fpermissive] entitiesHash.put(&DString("amp"), new SString("&")); ^ I am on uname -a Linux 4.3.0-sabayon #1 SMP Wed Dec 16 22:02:39 UTC 2015 x86_64 GNU/Linux gcc --version gcc (Gentoo Hardened 4.9.3 p1.1, pie-0.6.2) 4.9.3 perl -v This is perl 5, version 20, subversion 2 (v5.20.2) built for x86_64-linux-thread-multi The attached patch, although it might not be the most cleanest, fixed the compilation errors. On Wed Dec 22 18:28:48 2010, IRONCAMEL wrote: Show quoted text
> On Wed Nov 17 13:12:59 2010, dci2112@gmail.com wrote:
> > * > > Issue => > > Compile Errors: > > > > CachingHRCParser.cpp: In member function ‘virtual void > > CachingHRCParser::loadFileType(FileType*)’: > > CachingHRCParser.cpp:32: error: cast from ‘SchemeImpl*’ to ‘int’ loses > > precision > > ... > > Solution: > > > > 1) use #include <inttypes.h> and (intptr_t) for all casting issues: > > > > i.e. > > int pos = (intptr_t)f->baseScheme; > > > > instead of > > int pos = (int)f->baseScheme;
> > Following the above step fixed made the compile work. I had to edit 2 > files, CachingHRCParser.cpp and colorer/unicode/BitArray.cpp. > > -Naveed
Subject: build.log

Message body is not shown because it is too large.

Subject: Syntax-Highlight-Universal-0.5-compile.patch
diff -uNr a/CachingHRCParser.cpp b/CachingHRCParser.cpp --- a/CachingHRCParser.cpp 2005-03-13 18:14:47.000000000 +0100 +++ b/CachingHRCParser.cpp 2016-01-28 14:07:50.121059929 +0100 @@ -1,5 +1,7 @@ #include "CachingHRCParser.h" +#include <inttypes.h> + #include "EXTERN.h" #include "perl.h" #include "XSUB.h" @@ -29,7 +31,7 @@ if (!f->typeLoaded && f->baseScheme) { curFileType = f; - int pos = (int)f->baseScheme; + int pos = (intptr_t)f->baseScheme; deserialize(pos, f->baseScheme); f->typeLoaded = TRUE; f->loadDone = TRUE; diff -uNr a/colorer/cregexp/cregexp.cpp b/colorer/cregexp/cregexp.cpp --- a/colorer/cregexp/cregexp.cpp 2004-09-29 17:18:40.000000000 +0200 +++ b/colorer/cregexp/cregexp.cpp 2016-01-28 14:05:51.504059512 +0100 @@ -425,8 +425,12 @@ }; if (en == -1) return EBRACKETS; if (comma == -1) comma = en; - next->s = UnicodeTools::getNumber(&DString(&expr, st, comma-st)); - if (comma != en) next->e = UnicodeTools::getNumber(&DString(&expr, comma+1, en-comma-1)); + DString dstr = DString(&expr, st, comma-st); + next->s = UnicodeTools::getNumber(&dstr); + if (comma != en) { + DString dstr2 = DString(&expr, comma+1, en-comma-1); + next->e = UnicodeTools::getNumber(&dstr2); + } else next->e = next->s; if (next->e == -1) return EOP; next->un.param = 0; diff -uNr a/colorer/unicode/BitArray.cpp b/colorer/unicode/BitArray.cpp --- a/colorer/unicode/BitArray.cpp 2004-09-29 17:18:40.000000000 +0200 +++ b/colorer/unicode/BitArray.cpp 2016-01-28 13:40:34.328054168 +0100 @@ -1,6 +1,7 @@ #include<memory.h> #include<unicode/BitArray.h> +#include<inttypes.h> BitArray::BitArray(int size){ array = 0; @@ -8,7 +9,7 @@ if (size % 8 == 0 && size/8%4 == 0) this->size--; } BitArray::~BitArray(){ - if (array && int(array) != 1) delete[] array; + if (array && intptr_t(array) != 1) delete[] array; } void BitArray::createArray(bool set){ array = new int[size]; @@ -17,16 +18,16 @@ void BitArray::setBit(int pos){ if (!array) createArray(); - if (int(array) == 1) return; + if (intptr_t(array) == 1) return; array[pos>>5] |= 1 << (pos&0x1f); } void BitArray::clearBit(int pos){ if (!array) return; - if (int(array) == 1) createArray(true); + if (intptr_t(array) == 1) createArray(true); array[pos>>5] &= ~(1 << (pos&0x1f)); } void BitArray::addRange(int s, int e){ - if (int(array) == 1) return; + if (intptr_t(array) == 1) return; if (!array) createArray(); int cs = s>>5; if (s&0x1f){ @@ -49,7 +50,7 @@ } void BitArray::clearRange(int s, int e){ if (!array) return; - if (int(array) == 1) createArray(true); + if (intptr_t(array) == 1) createArray(true); int cs = s>>5; if (s&0x1f){ int fillbytes = 0xFFFFFFFF << (s&0x1f); @@ -70,9 +71,9 @@ }; } void BitArray::addBitArray(BitArray* ba){ - if (int(array) == 1) return; + if (intptr_t(array) == 1) return; if (!ba || !ba->array) return; - if (int(ba->array) == 1){ + if (intptr_t(ba->array) == 1){ array = (int*)1; return; }; @@ -83,8 +84,8 @@ void BitArray::clearBitArray(BitArray* ba){ if (array == null) return; if (ba == null || ba->array == null) return; - if (int(array) == 1) createArray(true); - if (int(ba->array) == 1){ + if (intptr_t(array) == 1) createArray(true); + if (intptr_t(ba->array) == 1){ if (array != null) delete[] array; array = 0; return; @@ -99,29 +100,29 @@ array = 0; return; }; - if (int(ba->array) == 1) return; - if (int(array) == 1) createArray(true); + if (intptr_t(ba->array) == 1) return; + if (intptr_t(array) == 1) createArray(true); for(int i = 0; i < size; i++) array[i] &= ba->array[i]; } void BitArray::addBitArray(char *bits, int size){ - if (int(array) == 1) return; + if (intptr_t(array) == 1) return; if (!array) createArray(); for(int i = 0; i < size && i < this->size*4;i++) ((char*)array)[i] |= bits[i]; } void BitArray::clearBitArray(char *bits, int size){ if (!array) return; - if (int(array) == 1) createArray(true); + if (intptr_t(array) == 1) createArray(true); for(int i = 0; i < size && i < this->size*4;i++) ((char*)array)[i] &= ~bits[i]; } bool BitArray::getBit(int pos){ if (!array) return false; - if (int(array) == 1) return true; + if (intptr_t(array) == 1) return true; return (array[pos>>5] & (1<<(pos&0x1f))) != 0; } diff -uNr a/colorer/unicode/SString.cpp b/colorer/unicode/SString.cpp --- a/colorer/unicode/SString.cpp 2004-09-29 17:18:40.000000000 +0200 +++ b/colorer/unicode/SString.cpp 2016-01-28 13:59:04.909058080 +0100 @@ -23,7 +23,8 @@ SString::SString(int no){ char text[40]; sprintf(text, "%d", no); - construct(&DString(text), 0, -1); + DString a = DString(text); + construct(&a, 0, -1); } SString::SString(){ wstr = null; diff -uNr a/colorer/unicode/UnicodeTools.cpp b/colorer/unicode/UnicodeTools.cpp --- a/colorer/unicode/UnicodeTools.cpp 2004-09-29 17:18:40.000000000 +0200 +++ b/colorer/unicode/UnicodeTools.cpp 2016-01-28 14:03:13.519058955 +0100 @@ -206,7 +206,8 @@ retPos += val_len+2; return tmp; }else{ - int tmp = getHexNumber(&DString(&str, pos+2, 2)); + DString dstr = DString(&str, pos+2, 2); + int tmp = getHexNumber(&dstr); if (str.length() <=pos+2 || tmp == -1) return BAD_WCHAR; retPos += 2; return tmp; diff -uNr a/colorer/xml/xmldom.cpp b/colorer/xml/xmldom.cpp --- a/colorer/xml/xmldom.cpp 2004-09-29 17:18:40.000000000 +0200 +++ b/colorer/xml/xmldom.cpp 2016-01-28 13:56:21.445057504 +0100 @@ -31,11 +31,16 @@ entitiesHash.clear(); extEntitiesHash.clear(); - entitiesHash.put(&DString("amp"), new SString("&")); - entitiesHash.put(&DString("lt"), new SString("<")); - entitiesHash.put(&DString("gt"), new SString(">")); - entitiesHash.put(&DString("quot"), new SString("\"")); - entitiesHash.put(&DString("apos"), new SString("\'")); + const DString dsa = DString("amp"); + const DString dsl = DString("lt"); + const DString dsg = DString("gt"); + const DString dsq = DString("quot"); + const DString dsp = DString("apos"); + entitiesHash.put(&dsa, new SString("&")); + entitiesHash.put(&dsl, new SString("<")); + entitiesHash.put(&dsg, new SString(">")); + entitiesHash.put(&dsq, new SString("\"")); + entitiesHash.put(&dsp, new SString("\'")); doc = newDocument(); doc->line = 0; diff -uNr a/Universal.xs b/Universal.xs --- a/Universal.xs 2005-03-13 18:30:47.000000000 +0100 +++ b/Universal.xs 2016-01-28 14:09:01.336060180 +0100 @@ -176,7 +176,8 @@ _addConfig(file) char* file; CODE: - InputSource* typesIS = InputSource::newInstance(&DString(file)); + DString dfile = DString(file); + InputSource* typesIS = InputSource::newInstance(&dfile); hrcParser.loadSource(typesIS); const char*