kayws426 / picoc

Automatically exported from code.google.com/p/picoc
0 stars 0 forks source link

Had very minor issue compiling on Solaris 10 spardc #196

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Compile of Solaris 10 6/06 u3 with gcc 3.4.3
2. Have issue of"CLK_TCK is not static initializer value, use 
sysconf(_SC_CLK_TCK) instead"
3. Slightly change cstdlib/time.c for solaris platform

I changed line 13 of time.c to something like:

#ifdef CLK_TCK
/** @bug CLK_TCK is not static initializer value
static int CLK_TCKValue = CLK_TCK; use sysconf(_SC_CLK_TCK) instead*/
        #ifdef HOST_SOLARIS
        static int CLK_TCKValue = 1;
        #else
        static int CLK_TCKValue = CLK_TCK;
        #endif
#endif

And I changed the line like:

VariableDefinePlatformVar(NULL, "CLK_TCK", &IntType, (union AnyValue 
*)&CLK_TCKValue, FALSE);

to:

#ifdef CLK_TCK
        #ifdef HOST_SOLARIS
    CLK_TCKValue = sysconf(_SC_CLK_TCK);
    #endif
    VariableDefinePlatformVar(NULL, "CLK_TCK", &IntType, (union AnyValue *)&CLK_TCKValue, FALSE);
#endif

And then if I define HOST_SOLARIS when building on solaris, no problem, and it 
still works as per usual on other platforms for me so I made these changes 
locally its good enough for me so far.

Original issue reported on code.google.com by me4t...@gmail.com on 5 May 2014 at 3:02