bug-gperf
[Top][All Lists]
Advanced

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

[bug-gperf] unhelpful gperf message 'check for len == 0'


From: Charlie Seddon
Subject: [bug-gperf] unhelpful gperf message 'check for len == 0'
Date: Tue, 19 Apr 2011 17:02:16 -0400
User-agent: Thunderbird 2.0.0.24 (X11/20110404)

I received this message when I attempted to use gperf 3.0.1 on a .gperf file that was working fine on gperf 2.7.1:

address@hidden:...ww/code/ALF % make alfContainerWords.cxx
/usr/bin/gperf -a -o -G -LANSI-C -k 1 -N _isContainerWord \
alfContainerWords.gperf > alfContainerWords.cxx
Empty input keyword is not allowed.
To recognize an empty input keyword, your code should check for
len == 0 before calling the gperf generated lookup function.
make: *** [alfContainerWords.cxx] Error 1

  
This made me initially think that I could add an inline 'if (len == 0) return NULL' call in the code to rectify the problem.  Attempting to do so did not solve the problem.

I then downloaded the source for 3.0.1 to debug the issue.  3.0.1 was attempting to use my source calls as keywords:
cat alfContainerWords.gperf
%{
#include <string.h>
%}
scan
from
to
limit
violation
information
%%
/* Wrapper function for _isContainerWord which gperf will generate */
const char* alfIsContainerWord(const char* name, size_t len)
{
    return _isContainerWord(name, len);
}

  
2.7.2 sees 'scan' as the first keyword, whereas 3.0.1 sees '/* Wrapper ...' a the first keyword.

Adding the proper delimiter '%%' before the first keyword resolved the problem.  This took a full day of debuggnig to decipher.  Please fix the error message, at least, to give some clearer indication of what is transpiring.  At the very least, please fix the debug message to include the name of the keywords that it thinks it is seeing.

I agree that the solution to this is obvious to someone newly building a gperf driver file.  For someone maintaning, upgrading, porting, etc., this was a bear to understand.

Thanks for whatever assistance you can provide in this matter...

-charlie






reply via email to

[Prev in Thread] Current Thread [Next in Thread]