[bug #23972] gv-3.6.5 won't build on solaris 9 with sun studio 11 compiler

View: New views
5 Messages — Rating Filter:   Alert me  

[bug #23972] gv-3.6.5 won't build on solaris 9 with sun studio 11 compiler

by Sharif Oerton-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


URL:
  <http://savannah.gnu.org/bugs/?23972>

                 Summary: gv-3.6.5 won't build on solaris 9 with sun studio
11 compiler
                 Project: GNU gv
            Submitted by: davediff
            Submitted on: Thursday 07/31/2008 at 21:43
                Category: None
                Severity: 3 - Normal
              Item Group: None
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
                 Release: None

    _______________________________________________________

Details:

I'm getting this compilation error:

cc -DHAVE_CONFIG_H -I.  -DNON_BLOCKING_IO -DGV_CODE -DGV_CODE
-DGV_LIBDIR=\"/usr/local/lib/gv\" -I../lib -I../lib -g -I/usr/local/include
-I/usr/openwin/include -DUSE_SETENV_CODE -g -c resource.c
"main_resources.h", line 244: zero or negative subscript
"main_resources.h", line 245: warning: syntax error:  empty initializer
cc: acomp failed for resource.c

The relevant line of code is in gv-3.6.5/src/main_resources.h:

static XrmOptionDescRec options[0] = {
};

I believe declaring arrays with zero length is a gcc extension and causes
this to break with Sun Studio 11 which is c99 compliant.

A link to a brief discussion of this:
http://developer.apple.com/documentation/DeveloperTools/gcc-4.0.1/gcc/Zero-Length.html

I attached a patch which leaves the zero out that compiles with only the
following warnings:

"main_resources.h", line 245: warning: syntax error:  empty initializer
"main_resources.h", line 245: warning: null dimension: options
"resource.c", line 342: warning: null dimension: sizeof()

I'm not sure if these are anything to worry about. I know that
sizeof(options) will return 0 which seems sensible. After building this way gv
appears to work fine while testing.

If this workaround looks correct, would it be possible to have it included in
the next release so that gv can be compiled on Solaris 9 without these
issues.

Thanks



    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Thursday 07/31/2008 at 21:43  Name: gv-zero-length.patch  Size: 411B  
By: davediff

<http://savannah.gnu.org/bugs/download.php?file_id=16218>

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?23972>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




[bug #23972] gv-3.6.5 won't build on solaris 9 with sun studio 11 compiler

by Sharif Oerton-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Update of bug #23972 (project gv):

                  Status:                    None => In Progress            
             Assigned to:                    None => msteinbo              
                 Release:                    None => 3.6.5                  

    _______________________________________________________

Follow-up Comment #1:

Thank cou for the bug report. The problem is: If I apply your patch, then

./configure CFLAGS="-Wall --pedantic --std=c99" ; make clean ; make

will result in

In file included from resource.c:54:
main_resources.h:245: Warnung: ISO-C verbietet leere
Initialisierungsklammern
main_resources.h:244: Fehler: Feldgröße von »options« ist null oder
negativ
make[2]: *** [resource.o] Fehler 1

on my linux system so it may break c89 and c99 compilers. Your warnimngs tell
you that after the patch your code is not c99 compliant.

I need some investigation to decide what to do. Comments are welcome.

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?23972>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




Re: [bug #23972] gv-3.6.5 won't build on solaris 9 with sun studio 11 compiler

by Bernhard R. Link-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

* Markus Steinborn <INVALID.NOREPLY@...> [080801 08:35]:
> I need some investigation to decide what to do. Comments are welcome.

Why handling options when there are none? I'd just suggest to drop the
options variable and the XrmParseCommand call.

Hochachtungsvoll,
        Bernhard R. Link
--
"Never contain programs so few bugs, as when no debugging tools are available!"
        Niklaus Wirth



[bug #23972] gv-3.6.5 won't build on solaris 9 with sun studio 11 compiler

by Sharif Oerton-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Update of bug #23972 (project gv):

                  Status:             In Progress => Ready For Test        


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?23972>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




[bug #23972] gv-3.6.5 won't build on solaris 9 with sun studio 11 compiler

by Sharif Oerton-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Update of bug #23972 (project gv):

                  Status:          Ready For Test => Fixed                  
             Open/Closed:                    Open => Closed                


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?23972>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/



LightInTheBox - Buy quality products at wholesale price!