poke-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] fix declarations in bison files


From: Kostas Chasialis
Subject: Re: [PATCH] fix declarations in bison files
Date: Mon, 6 Dec 2021 15:28:35 +0200

Hello, Mohammad.

I applied this patch on jitter and it compiled just fine.

Thanks.

> On 6 Dec 2021, at 1:19 AM, Mohammad-Reza Nabipoor <mnabipoor@gnu.org> wrote:
> 
> * jitterc/jitterc.y (jitterc_error): Remove static keyword, mark
> first and last arguments as const.
> (%code requires): Add typedef jitterc_scan_t.
> 
> * jitter/jitter-routine.y (jitter_error): Likewise.
> (%code requires): Add typedef jitter_scan_t.
> 
> * example-vms/structured/structured.y (jitter_error): Likewise.
> (%code requires): Add typedef structured_scan_t.
> ---
> 
> Hello, Kostas.
> 
> With this patch, jitter can be compiled using
>  gcc version 5.3.1 20160413 (Ubuntu 5.3.1-14ubuntu2)
> in Ubuntu 16.04 (Xenial).
> 
> (with latest versions of flex and bison compiled from source)
> 
> 
> Regards,
> Mohammad-Reza
> 
> example-vms/structured/structured.y | 12 +++++++-----
> jitter/jitter-routine.y             |  8 +++++---
> jitterc/jitterc.y                   | 12 +++++++-----
> 3 files changed, 19 insertions(+), 13 deletions(-)
> 
> diff --git a/example-vms/structured/structured.y 
> b/example-vms/structured/structured.y
> index 7ca8d4a..7a2687d 100644
> --- a/example-vms/structured/structured.y
> +++ b/example-vms/structured/structured.y
> @@ -34,9 +34,9 @@
> #include "structured-scanner.h"
> 
> /* This is currently a fatal error.  I could longjmp away instead. */
> -static void
> -structured_error (YYLTYPE *locp, struct structured_program *p,
> -                  yyscan_t scanner, char *message)
> +void
> +structured_error (const YYLTYPE *locp, struct structured_program *p,
> +                  yyscan_t scanner, const char *message)
>   __attribute__ ((noreturn));
> 
> #define STRUCTURED_PARSE_ERROR(message)                            \
> @@ -286,6 +286,8 @@ structured_parse_file_star (FILE *input_file);
> 
> struct structured_program *
> structured_parse_file (const char *input_file_name);
> +
> +typedef void* structured_scan_t;
> } /* end of %code requires */
> 
> %union
> @@ -618,8 +620,8 @@ end:
> %%
> 
> void
> -structured_error (YYLTYPE *locp, struct structured_program *p, yyscan_t 
> structured_scanner,
> -                 char *message)
> +structured_error (const YYLTYPE *locp, struct structured_program *p, 
> yyscan_t structured_scanner,
> +                 const char *message)
> {
>   printf ("%s:%i: %s near \"%s\".\n",
>           (p != NULL) ? p->source_file_name : "<INPUT>",
> diff --git a/jitter/jitter-routine.y b/jitter/jitter-routine.y
> index e5d5896..ab1bd33 100644
> --- a/jitter/jitter-routine.y
> +++ b/jitter/jitter-routine.y
> @@ -32,8 +32,8 @@
>   #include <jitter/jitter-fatal.h>
> 
>   /* This is currently a fatal error.  I could longjmp away instead. */
> -  static void
> -  jitter_error (YYLTYPE *locp,
> +  void
> +  jitter_error (const YYLTYPE *locp,
>                 struct parser_arg *parser_arg, /*struct 
> jitter_mutable_routine *routine,*/
>                 yyscan_t scanner, const char *message)
>     __attribute__ ((noreturn));
> @@ -177,6 +177,8 @@
>                                             struct jitter_mutable_routine *p,
>                                             const struct jitter_vm *vm)
>     __attribute__ ((nonnull (1, 2, 3)));
> +
> +  typedef void* jitter_scan_t;
> }
> 
> %union {
> @@ -304,7 +306,7 @@ argument :
> /* FIXME: the error-reporting facility in generator/generator.y is derived
>    from this, but improved. */
> void
> -jitter_error (YYLTYPE *locp,
> +jitter_error (const YYLTYPE *locp,
>               struct parser_arg *parser_arg,
>               yyscan_t jitter_scanner, const char *message)
> {
> diff --git a/jitterc/jitterc.y b/jitterc/jitterc.y
> index 25157a9..fd862e3 100644
> --- a/jitterc/jitterc.y
> +++ b/jitterc/jitterc.y
> @@ -47,9 +47,9 @@
> #include "jitterc-scanner.h"
> 
> /* This is currently a fatal error.  I could longjmp away instead. */
> -static void
> -jitterc_error (YYLTYPE *locp, struct jitterc_vm *vm,
> -               yyscan_t scanner, char *message)
> +void
> +jitterc_error (const YYLTYPE *locp, struct jitterc_vm *vm,
> +               yyscan_t scanner, const char *message)
>   __attribute__ ((noreturn));
> 
> #define JITTERC_PARSE_ERROR(message)                      \
> @@ -216,6 +216,8 @@ jitterc_parse_file_star (FILE *input_file, bool 
> generate_line);
>    given. */
> struct jitterc_vm *
> jitterc_parse_file (const char *input_file_name, bool generate_line);
> +
> +typedef void* jitterc_scan_t;
> }
> 
> %union
> @@ -916,8 +918,8 @@ literals:
> %%
> 
> void
> -jitterc_error (YYLTYPE *locp, struct jitterc_vm *vm, yyscan_t 
> jitterc_scanner,
> -                 char *message)
> +jitterc_error (const YYLTYPE *locp, struct jitterc_vm *vm, yyscan_t 
> jitterc_scanner,
> +               const char *message)
> {
>   printf ("%s:%i: %s near \"%s\".\n",
>           (vm != NULL) ? vm->source_file_name : "<INPUT>",
> -- 
> 2.7.4
> 




reply via email to

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