bug-recutils
[Top][All Lists]
Advanced

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

Re: [PATCH] C99 compatibility fix


From: Jose E. Marchesi
Subject: Re: [PATCH] C99 compatibility fix
Date: Thu, 15 Dec 2022 14:56:23 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Hi Florian.

Thank you very much for the patch.  I find the approach ok, and I just
applied the patch on your behalf.

> I researched this quite a bit, and this approach seems to be the least
> bad option.
>
> Future compilers are likely to require functions to be declared before
> they can be called.  The flex lexer generator can be taught to create a
> header file with the required declarations.  However, automake conspires
> against us to use it during the build.  So I extracted the relevant
> declarations by hand and put it into a non-generated header file.  At
> least the declarations are checked against the definitions in
> rec-sex-lex.c, so maybe it's not too bad after all.
>
> Related to:
>
>   <https://fedoraproject.org/wiki/Changes/PortingToModernC>
>   <https://fedoraproject.org/wiki/Toolchain/PortingToModernC>
>
> diff --git a/.gitignore b/.gitignore
> index e2d1aac..18ed187 100644
> --- a/.gitignore
> +++ b/.gitignore
> @@ -41,7 +41,6 @@ libtool
>  /src/config.h.in
>  /src/stamp-h1
>  /src/rec-sex-lex.c
> -/src/rec-sex-lex.h
>  /src/rec-sex-tab.c
>  /src/rec-sex-tab.h
>  /torture/runtests
> diff --git a/src/rec-sex-lex.h b/src/rec-sex-lex.h
> new file mode 100644
> index 0000000..4bfc1dc
> --- /dev/null
> +++ b/src/rec-sex-lex.h
> @@ -0,0 +1,7 @@
> +/* Declarations exported from the generated lexer. */
> +
> +int sexlex_init (void **);
> +void sexset_extra (void *, void *);
> +int sexlex_destroy (void *);
> +union YYSTYPE;
> +int sexlex (union YYSTYPE *, void *);
> diff --git a/src/rec-sex-lex.l b/src/rec-sex-lex.l
> index 1e537bf..2d4a891 100644
> --- a/src/rec-sex-lex.l
> +++ b/src/rec-sex-lex.l
> @@ -26,12 +26,12 @@
>  %option bison-bridge
>  %option extra-type="void *"
>  
> -%option header-file="rec-sex-lex.h"
>  %option nounput
>  %option noinput
>  %top {
>     /* This code goes at the "top" of the generated file.  */
>     #include <config.h>
> +   #include "rec-sex-lex.h"
>  }
>  
>  %{
> diff --git a/src/rec-sex-parser.c b/src/rec-sex-parser.c
> index e5bcd33..4eb188a 100644
> --- a/src/rec-sex-parser.c
> +++ b/src/rec-sex-parser.c
> @@ -25,7 +25,7 @@
>  
>  #include <rec-sex-parser.h>
>  #include "rec-sex-tab.h"
> -/*#include "rec-sex-lex.h" */
> +#include "rec-sex-lex.h"
>  
>  struct rec_sex_parser_s
>  {
> diff --git a/src/rec-sex-tab.y b/src/rec-sex-tab.y
> index 6c31edd..f011bc4 100644
> --- a/src/rec-sex-tab.y
> +++ b/src/rec-sex-tab.y
> @@ -33,7 +33,7 @@
>    #include <rec-sex-ast.h>
>    #include <rec-sex-parser.h>
>    #include "rec-sex-tab.h"
> -  /*  #include "rec-sex-lex.h" */
> +  #include "rec-sex-lex.h"
>  
>    void sexerror (rec_sex_parser_t context, const char *err)
>    {
>
> Thanks,
> Florian



reply via email to

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