Thu 31 Jul 2008 09:43:05 PM UTC, original submission:
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
|