Menu

#150 Patch for building on GCC and aCC

closed-accepted
5
2007-07-23
2007-07-23
No

Thanks to Portante and kichik for parts of the patch and to HP for
providing various flavors of GNU/Linux and HP-UX via
http://www.testdrive.hp.com/ for free (I recommend this to try the patch
and test various other issues and questions).

The attached patch eliminates all errors/warnings on:

GCC: 4.1.2
aCC: HP C/aC++ B3910B A.06.14 [Feb 22 2007]

It eliminates all errors on:

aCC: HP ANSI C++ B3910B A.03.77

But the following warnings remain:

Frequency: #Id: Text

8: #863: Result of operator << is widened from unsigned int to unsigned long long

23: #749: The cast from '' to '' is performed as a 'reinterpret_cast'. This operation is non-portable and potentially unsafe.

35: #921: A trailing comma is not allowed in an enumeration.

708: #829: Implicit conversion of string literal to 'char *' is deprecated.

Any of these aCC warnings can be suppressed by using its Id in a
compiler flag:

+Warg1[,arg2,...,argn]
Selectively suppresses any specified warning messages,
where arg1 through argn are valid compiler warning
message numbers.

Here are the details regarding what is fixed in this patch:
1. "-Wno-non-virtual-dtor" should be only used for g++, not gcc

2. Specify "-AA" as it is not the default for all versions of aCC

3. in Source/build.cpp, *out++ is defined as char, so change the
following from:

*out++ = (unsigned int) NS_VAR_CODE;
*out++=(unsigned int)NS_SHELL_CODE;
*out++ = (unsigned int)NS_LANG_CODE;

to:
*out++ = (char) NS_VAR_CODE;
*out++=(char)NS_SHELL_CODE;
*out++ = (char)NS_LANG_CODE;

4. 'extern "C"' should not be inside main

5. name the two anonymous unions: UName and UOffset (but I'm
terrible with names so maybe there is a better name for these that can
be used)

6. strftime - in both linux and hpux, strftime returns size_t as
follows:

HPUX:
If the total number of resulting bytes including the terminating null
byte is not more than maxsize, strftime() returns the number of bytes
placed into the array pointed to by s, not including the terminating
null byte. Otherwise, zero is returned and the contents of the array
are indeterminate.

Linux:
The strftime() function returns the number of characters placed in the
array s, not including the terminating null byte, provided the string,
including the terminating null byte, fits. Otherwise, it returns 0,
and the contents of the array is undefined.

7. comment out return that can never be reached

8. specify throw in new, and delete

9. readlink - in both linux and hpux, readlink returns int as follows:

HPUX:
Upon successful completion, readlink() returns the count of bytes
placed in the buffer. Otherwise, it returns a value of -1, leaves the
buffer unchanged, and sets errno to indicate the error.

Linux:
The call returns the count of characters placed in the buffer if it
succeeds, or a -1 if an error occurs, placing the error code in errno.

Discussion

  • David Everly

    David Everly - 2007-07-23

    Patch for GCC and aCC on GNU/Linux and HPUX

     
  • David Everly

    David Everly - 2007-07-23

    Version 2 of Patch for GCC and aCC on GNU/Linux and HPUX

     
  • David Everly

    David Everly - 2007-07-23

    Logged In: YES
    user_id=1113403
    Originator: YES

    I missed one of the changes I should have included in my earlier patch:

    10. When building with gcc on hpux ia64, there warnings like this:

    Source/makenssi.cpp:155: warning: format '%d' expects type 'int', but argument 3 has type 'long unsigned int'

    File Added: nsis.patch-2.gz

     
  • Amir Szekely

    Amir Szekely - 2007-07-23

    Logged In: YES
    user_id=584402
    Originator: NO

    Thanks! Applied and test on Windows.

     
  • Amir Szekely

    Amir Szekely - 2007-07-23
    • labels: --> Build System
    • assigned_to: nobody --> kichik
    • status: open --> closed-accepted
     

Log in to post a comment.