Offering fixes for SUN 4.2 and Forte 6.1 compilers

   Hi Gnome'ers,

   I am an avid gnome user and Sun software build/release engineer.
I have built Gnome 1.4 under the older Sun CC4.2 compiler (for Sol 2.5.1)
and the new Sun Forte 6.1 compiler (for Sol 6 through 8).

   As you can imagine Gcc and SunCC compilers have differing levels of
strictness that make them incompatible on the first pass.  I would like
to check in a number of small changes to various packages that fix these
inconsistencies.  For the most part they are just sloppy constructs that
gcc allows but ANSI and other compilers do not.

   Typical examples are as such:

-- A swtich/case block cannot have a completely blank last case.

   switch( num ) { case: do_it(); break; default: }        Gcc only
   switch( num ) { case: do_it(); break; default: break; } All comps
                                added the break---^

-- There are a number of cases in Gnome where the function prototype
   declares an enum return type but the function definition declares
   and an int.  This is allowed in Gcc because of relaxed type-ing.

   GnomeEnum testfunc();
   gint testfunc() { do something; }

-- You cannot do pointer arithmetic on a (void *). I have no idea why
   gcc allows this because it is just asking for a SEGV.

   char * string = "this is a test";
   void * buffer = string;
   void * walker = buffer + 12; <-- This is very very illegal. Is it
                                  a 12 byte offset or a 48 byte offset?

-- Use of alloca() requires inclusion of <alloca.h> on Sun systems.

   This requires a simple #ifdef for sun systems to include this header.

-- Most compilers do not support the "inline" keyword in C so this
   should be detected and dealt with on non Gcc systems.

-- __FUNCTION__ and __PRETTY_FUNCTION__ are 100% Gcc compiler macros and
   I am looking into the Sun equivalent for them.  This is another ifdef
   that can be generated in the config.h.

-- Many Gnome packages hard assume that Gcc is the one and only compiler.
   They insert gcc specific args like -Wall and -fPIC without checking.
   A few do check for the compiler type and then ignore the test results.
   This amounts to some minor tweaking.

   I am looking for any info on how to do this in the cvs tree.  I figure
   that if no easier method presents itself this I will have to talk to
   each project owner separately but I dont know if I have the fortitude
   to go that route.  Does anyone on this list know of a central authority
   or person who could authorize work across projects?

   Any help is greatly appreciated
   Morey Hubin

"At the beginning of the week, we sealed ten BSD programmers
 into a computer room with a single distribution of BSD Unix.
 Upon opening the room after seven days, we found all ten
 programmers dead, clutching each others' throats,
 and thirteen new flavors of BSD." 

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]