hyperrealm / libconfig

C/C++ library for processing configuration files
https://hyperrealm.github.io/libconfig/
GNU Lesser General Public License v2.1
1.11k stars 361 forks source link

too few arguments to function 'scanctx_push_include' #77

Closed herbert-wu closed 6 years ago

herbert-wu commented 7 years ago

hi, What is reason of "too few arguments to function 'scanctx_push_include' ? Both build in ubuntu and vs2013 repored。

nurupo commented 7 years ago

Getting the same error building v1.6 from github. GCC 6.3.0.

  CC       libconfig_la-scanner.lo
scanner.l: In function 'libconfig_yylex':
scanner.l:137:53: warning: passing argument 3 of 'scanctx_push_include' from incompatible pointer type [-Wincompatible-pointer-types]
                     char c[2] = { (char)(strtol(yytext + 2, NULL, 16) & 0xFF),
                                                     ^
In file included from scanner.l:46:0:
scanctx.h:66:14: note: expected 'const char *' but argument is of type 'const char **'
 extern FILE *scanctx_push_include(struct scan_context *ctx, void *prev_buffer,
              ^~~~~~~~~~~~~~~~~~~~
scanner.l:135:32: error: too few arguments to function 'scanctx_push_include'
 <STRING>\\\"      { scanctx_append_string(yyextra, "\""); }
                                ^~~~~~~~~~~~~~~~~~~~
In file included from scanner.l:46:0:
scanctx.h:66:14: note: declared here
 extern FILE *scanctx_push_include(struct scan_context *ctx, void *prev_buffer,
              ^~~~~~~~~~~~~~~~~~~~
Makefile:614: recipe for target 'libconfig_la-scanner.lo' failed

v1.5 from tarball builds fine though. Didn't check v1.5 from github, I assume they are the same.

Peter-YAN commented 7 years ago

I change include statement of scanner.l, the problem is solved.

FROM

include

include

include

include

include

include

include "parsectx.h"

#include "scanctx.h"

include "grammar.h"

include "wincompat.h"

TO

#include "scanctx.h"

include

include

include

include

include

include

include "parsectx.h"

include "grammar.h"

include "wincompat.h"

jltallon commented 7 years ago

On 21/09/17 08:33, Peter-YAN wrote:

I change include statement of scanner.l, the problem is solved.

FROM

include

include

include

include

include

include

include "parsectx.h"

/#include "scanctx.h"/

include "grammar.h"

include "wincompat.h"

I never encountered that error with my compiler.... which toolchain are you using ?

TO

/#include "scanctx.h"/

include

include

include

include

include

include

rather HERE. System includes should go first ....

include "parsectx.h"

include "grammar.h"

include "wincompat.h"

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/hyperrealm/libconfig/issues/77#issuecomment-331064874, or mute the thread https://github.com/notifications/unsubscribe-auth/ABzJesEql6Fw2gu_WJHpBeF5jIy5G7JPks5skgMxgaJpZM4N6zIV.

Peter-YAN commented 7 years ago

gcc (GCC) 4.8.5 automake (GNU automake) 1.5 autoconf (GNU Autoconf) 2.69

hyperrealm commented 6 years ago

I've removed the generated files (grammar.[ch], scanner.[ch]) from the repository. They were out of sync with the corresponding grammar.y, scanner.l

To fix this locally, just delete those files.

ysagon commented 6 years ago

As this seems to fix the issue, may I ask you to create a new github release tag with this solved?

I'm using an automated build system that rely on release tag to download the correct archive.

By the way, I don't know if the issue #66 is fixed in head (about make -j), but in the release 1.6 it's not, it's only working with make -j1

hyperrealm commented 6 years ago

I can't repro #66...

cd lib ; make maintainer-clean-generic ; make This command is intended for maintainers to use it deletes files that may require special tools to rebuild. rm -f grammar.c rm -f grammar.h rm -f scanner.c test -z "scanner.c scanner.h grammar.c grammar.h" || rm -f scanner.c scanner.h grammar.c grammar.h LEX scanner.c updating scanner.h YACC grammar.c updating grammar.h make all-am make[1]: Entering directory '/home/markl/git/libconfig/lib' CC libconfig_la-libconfig.lo CC libconfig_la-scanner.lo CC libconfig_la-grammar.lo CCLD libconfig.la ar: u' modifier ignored sinceD' is the default (see U') CC libconfig___la-libconfig.lo CC libconfig___la-scanner.lo CC libconfig___la-grammar.lo CXXLD libconfig++.la ar:u' modifier ignored since D' is the default (seeU') make[1]: Leaving directory '/home/markl/git/libconfig/lib'

hyperrealm commented 6 years ago

On further thought it may not be such a good idea to exclude those lex/bison generated files from the repo...it's going to make building on Windows a real headache if you don't happen to have those tools available, which I suspect would be the case for most people who are using Visual Studio.

hyperrealm commented 6 years ago

Also regarding tagging, I still have a few more changes to commit for 1.7. Once that's done I'll tag it with that version.