/home/schmidt/clearsilver/util/dict.c, 563.77: CZM0041(20) The invocation
of macro nerr_raise contains fewer arguments than are required by the
macro definition.
The compiler uses C99 style var args.
ILE C Language Reference:
Function-Like Macros
More complex than object-like macros, a function-like macro definition declares the names of formal parameters within parentheses, separated by commas. An empty formal parameter list is legal: such a macro can be used to simulate a function that takes no arguments.
Function-like macro definition: An identifier followed by a parameter list in parentheses and the replacement tokens. The parameters are imbedded in the replacement code. White space cannot separate the identifier (which is the name of the macro) and the left parenthesis of the parameter list. A comma must separate each parameter. For portability, you should not have more than 31 parameters for a macro. The parameter list may end with an ellipsis (...). In this case, the identifier __VA_ARGS__ may appear in the replacement list.
Function-like macro invocation: An identifier followed by a comma-separated list of arguments in parentheses. The number of arguments should match the number of parameters in the macro definition, unless the parameter list in the definition ends with an ellipsis. In this latter case, the number of arguments in the invocation should exceed the number of parameters in the definition. The excess are called trailing arguments. Once the preprocessor identifies a function-like macro invocation, argument substitution takes place. A parameter in the replacement code is replaced by the corresponding argument. If trailing arguments are permitted by the macro definition, they are merged with the intervening commas to replace the identifier __VA_ARGS__, as if they were a single argument. Any macro invocations contained in the argument itself are completely replaced before the argument replaces its corresponding parameter in the replacement code. This language feature is an orthogonal extension of C++.
If the identifier list does not end with an ellipsis, the number of arguments in a macro invocation must be the same as the number of parameters in the corresponding macro definition. During parameter substitution, any arguments remaining after all specified arguments have been substituted (including any separating commas) are combined into one argument called the variable argument. The variable argument will replace any occurrence of the identifier __VA_ARGS__ in the replacement list. The following example illustrates this:
I'm not a C programmer and don't understand the following code (which create the error message in the compilation):
dict.c: nerr_raise(NERR_ASSERT, "value or new are NULL");
neo_err.h:
#if defined(USE_C99_VARARG_MACROS)
#define nerr_raise(e , f , ...) \
nerr_raisef(__PRETTY_FUNCTION__ , __FILE__ , __LINE__ , e , f , __VA_ARGS__)
#elif defined(USE_GNUC_VARARG_MACROS)
#define nerr_raise(e,f,a...) \
nerr_raisef(__PRETTY_FUNCTION__,__FILE__,__LINE__,e,f,##a)
#endif
Question: Why is dict.c calling nerr_raise with only 2 parm. Shouldn't it be three parms (error type, format string and error message)? I definitely got something wrong but I don't know what?
The language reference says: ... the number of arguments in the invocation should exceed the number of parameters in the definition ...
I suspect the real problem is with the other macros __PRETTY_FUNCTION, __FILE__
and __LINE__. These are magic macros defined by some compilers, but they might
not be defined by your compiler. You can try to make the compile work simply by
replaceing these arguments with actual values. Try replacing this:
nerr_raisef(__PRETTY_FUNCTION__ , __FILE__ , __LINE__ , e , f , __VA_ARGS__)
With this:
nerr_raisef("test", "test" , "test" , e , f , __VA_ARGS__)
-- Schmidt, Mihael wrote:
> Question: Why is dict.c calling nerr_raise with only 2 parm. Shouldn't it be
> three parms (error type, format string and error message)? I definitely got
> something wrong but I don't know what?
nerr_raise() is setup to work like the printf() family of functions. For
example, you might have:
nerr_raise(NERR_ASSERT, "problematic value %d", local_variable_int);
Because the statement you referenced has no % formatting, it has no arguments.
nerr_raise(NERR_ASSERT, "value or new are NULL");
-- Schmidt, Mihael wrote:
> Question: Why is dict.c calling nerr_raise with only 2 parm. Shouldn't
it be
> three parms (error type, format string and error message)? I
definitely got
> something wrong but I don't know what?
nerr_raise() is setup to work like the printf() family of functions. For
example, you might have:
nerr_raise(NERR_ASSERT, "problematic value %d", local_variable_int);
Because the statement you referenced has no % formatting, it has no
arguments.
nerr_raise(NERR_ASSERT, "value or new are NULL");
Mihael: ... and that was my problem. The ILE C compiler expects to have
at least one variable argument if __VA_ARGS__ is used. I added an empty
string and it works now, like:
nerr_raise(NERR_ASSERT, "value or new are NULL", "");
But now I got another problem: The lockf() function is not available on
System i for ILE C. Is there a way to replace this function? A
workaround?
lockf() is used in util/ulock.c, function fLock and fFind.
I compiled clearsilver on a linux system and took the cs_config.h from it (and
modified it a little bit). Now i see that there is a setting for the
availability of lockf() :
/* Does your system have lockf ? */
/* #define HAVE_LOCKF 1 */
On the linux system there is of course lockf() but not on System i. So I put it
in comments. But it does not seem to do anything. Haven't found anything in
ulocks.c or ulocks.h.
Can I somehow use fcntl() instead of lockf() as a workaround?
-- Schmidt, Mihael wrote:
> Question: Why is dict.c calling nerr_raise with only 2 parm. Shouldn't
it be
> three parms (error type, format string and error message)? I
definitely got
> something wrong but I don't know what?
nerr_raise() is setup to work like the printf() family of functions. For
example, you might have:
nerr_raise(NERR_ASSERT, "problematic value %d", local_variable_int);
Because the statement you referenced has no % formatting, it has no
arguments.
nerr_raise(NERR_ASSERT, "value or new are NULL");
Mihael: ... and that was my problem. The ILE C compiler expects to have
at least one variable argument if __VA_ARGS__ is used. I added an empty
string and it works now, like:
nerr_raise(NERR_ASSERT, "value or new are NULL", "");
But now I got another problem: The lockf() function is not available on
System i for ILE C. Is there a way to replace this function? A
workaround?
lockf() is used in util/ulock.c, function fLock and fFind.
After some searching on the web I found that HAVE_LOCKF is queried in
Clearsilver.h. There is seems that ulock, rcfs, dict and skiplist are optional
(are not included if not supported on the system). Is that so? Can I go on with
the rest of the sources?
I compiled clearsilver on a linux system and took the cs_config.h from it (and
modified it a little bit). Now i see that there is a setting for the
availability of lockf() :
/* Does your system have lockf ? */
/* #define HAVE_LOCKF 1 */
On the linux system there is of course lockf() but not on System i. So I put it
in comments. But it does not seem to do anything. Haven't found anything in
ulocks.c or ulocks.h.
Can I somehow use fcntl() instead of lockf() as a workaround?
Any idea?
Mihael
-----Ursprüngliche Nachricht-----
Von: ClearSilver@yahoogroups.com <mailto:ClearSilver%40yahoogroups.com>
[mailto:ClearSilver@yahoogroups.com <mailto:ClearSilver%40yahoogroups.com> ] Im
Auftrag von Schmidt, Mihael
Gesendet: Freitag, 12. Juni 2009 07:17
An: ClearSilver@yahoogroups.com <mailto:ClearSilver%40yahoogroups.com>
Betreff: AW: Compile ClearSilver on System i
-- Schmidt, Mihael wrote:
> Question: Why is dict.c calling nerr_raise with only 2 parm. Shouldn't
it be
> three parms (error type, format string and error message)? I
definitely got
> something wrong but I don't know what?
nerr_raise() is setup to work like the printf() family of functions. For
example, you might have:
nerr_raise(NERR_ASSERT, "problematic value %d", local_variable_int);
Because the statement you referenced has no % formatting, it has no
arguments.
nerr_raise(NERR_ASSERT, "value or new are NULL");
Mihael: ... and that was my problem. The ILE C compiler expects to have
at least one variable argument if __VA_ARGS__ is used. I added an empty
string and it works now, like:
nerr_raise(NERR_ASSERT, "value or new are NULL", "");
But now I got another problem: The lockf() function is not available on
System i for ILE C. Is there a way to replace this function? A
workaround?
lockf() is used in util/ulock.c, function fLock and fFind.
Yes, they aren't necessary for the template system or cgi code, they're
just extra.
Brandon
On 06/12/09 Schmidt, Mihael uttered the following other thing:
> After some searching on the web I found that HAVE_LOCKF is queried in
Clearsilver.h. There is seems that ulock, rcfs, dict and skiplist are optional
(are not included if not supported on the system). Is that so? Can I go on with
the rest of the sources?
>
> Thanx for any help in advance
>
> Mihael
>
> -----Ursprüngliche Nachricht-----
> Von: ClearSilver@yahoogroups.com [mailto:ClearSilver@yahoogroups.com] Im
Auftrag von Schmidt, Mihael
> Gesendet: Freitag, 12. Juni 2009 07:34
> An: ClearSilver@yahoogroups.com
> Betreff: AW: Compile ClearSilver on System i
>
>
>
> oh... it is util/ulocks.c (not util.ulock.c)
>
> I compiled clearsilver on a linux system and took the cs_config.h from it (and
modified it a little bit). Now i see that there is a setting for the
availability of lockf() :
>
> /* Does your system have lockf ? */
> /* #define HAVE_LOCKF 1 */
>
> On the linux system there is of course lockf() but not on System i. So I put
it in comments. But it does not seem to do anything. Haven't found anything in
ulocks.c or ulocks.h.
>
> Can I somehow use fcntl() instead of lockf() as a workaround?
>
> Any idea?
>
> Mihael
>
> -----Ursprüngliche Nachricht-----
> Von: ClearSilver@yahoogroups.com <mailto:ClearSilver%40yahoogroups.com>
[mailto:ClearSilver@yahoogroups.com <mailto:ClearSilver%40yahoogroups.com> ] Im
Auftrag von Schmidt, Mihael
> Gesendet: Freitag, 12. Juni 2009 07:17
> An: ClearSilver@yahoogroups.com <mailto:ClearSilver%40yahoogroups.com>
> Betreff: AW: Compile ClearSilver on System i
>
> -- Schmidt, Mihael wrote:
> > Question: Why is dict.c calling nerr_raise with only 2 parm. Shouldn't
> it be
> > three parms (error type, format string and error message)? I
> definitely got
> > something wrong but I don't know what?
>
> nerr_raise() is setup to work like the printf() family of functions. For
> example, you might have:
>
> nerr_raise(NERR_ASSERT, "problematic value %d", local_variable_int);
>
> Because the statement you referenced has no % formatting, it has no
> arguments.
> nerr_raise(NERR_ASSERT, "value or new are NULL");
>
> Mihael: ... and that was my problem. The ILE C compiler expects to have
> at least one variable argument if __VA_ARGS__ is used. I added an empty
> string and it works now, like:
>
> nerr_raise(NERR_ASSERT, "value or new are NULL", "");
>
> But now I got another problem: The lockf() function is not available on
> System i for ILE C. Is there a way to replace this function? A
> workaround?
>
> lockf() is used in util/ulock.c, function fLock and fFind.
>
> Any ideas would be great.
>
> Thanx in advance.
>
> Mihael
>
>
>
>
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>
>
>
--
"This universe never did make sense; I suspect it was built on a
government contract." -- Robert A. Heinlein http://www.fiction.net/blong/