>From 568af94a3daea696e0e41442e8bb7c4d62b391b7 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Tue, 2 Mar 2021 02:19:27 +0100 Subject: [PATCH 4/5] Fix a compilation error with GCC < 4.6. * libpoke/pkl-compiler.h: New file, extracted from libpoke/pkl.h. * libpoke/pkl.h: Include it. (pkl_compiler): Remove type definition. * libpoke/pvm.h: Likewise. * libpoke/Makefile.am (libpoke_la_SOURCES): Add pkl-compiler.h. --- libpoke/Makefile.am | 1 + libpoke/pkl-compiler.h | 27 +++++++++++++++++++++++++++ libpoke/pkl.h | 6 +++--- libpoke/pvm.h | 3 +-- 4 files changed, 32 insertions(+), 5 deletions(-) create mode 100644 libpoke/pkl-compiler.h diff --git a/libpoke/Makefile.am b/libpoke/Makefile.am index ee5a72d..97baca8 100644 --- a/libpoke/Makefile.am +++ b/libpoke/Makefile.am @@ -34,6 +34,7 @@ libpoke_la_SOURCES = libpoke.h libpoke.c \ pkt.h \ pkl.h pkl.c \ pkl-ast.h pkl-ast.c \ + pkl-compiler.h \ pkl-env.h pkl-env.c \ pkl-pass.h pkl-pass.c \ pkl-promo.h pkl-promo.c \ diff --git a/libpoke/pkl-compiler.h b/libpoke/pkl-compiler.h new file mode 100644 index 0000000..8bdd2dc --- /dev/null +++ b/libpoke/pkl-compiler.h @@ -0,0 +1,27 @@ +/* pkl-compiler.h - Type of Poke compiler. */ + +/* Copyright (C) 2019, 2020, 2021 Jose E. Marchesi */ + +/* This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef PKL_COMPILER_H +#define PKL_COMPILER_H + +/* Defined in pkl.c. */ +struct pkl_compiler; + +typedef struct pkl_compiler *pkl_compiler; + +#endif /* ! PKL_COMPILER_H */ diff --git a/libpoke/pkl.h b/libpoke/pkl.h index d016eac..9f86a79 100644 --- a/libpoke/pkl.h +++ b/libpoke/pkl.h @@ -23,6 +23,7 @@ #include #include +#include "pkl-compiler.h" #include "pvm.h" /*** Compiler Services. ***/ @@ -36,6 +37,8 @@ The PKL compiler works as follows: + A Poke compiler is represented by a `pkl_compiler'. + First, a compiler is created and initialized with `pkl_new'. At this point, the internal program is almost empty, but not quite: part of the compiler is written in poke itself, and thus it needs @@ -60,9 +63,6 @@ longer needed, in order to do some finalization tasks and free resources. */ -typedef struct pkl_compiler *pkl_compiler; /* This data structure is - defined in pkl.c */ - /* Initialization and finalization functions. */ /* Create and return a new compiler. diff --git a/libpoke/pvm.h b/libpoke/pvm.h index 30e9b7b..82201cb 100644 --- a/libpoke/pvm.h +++ b/libpoke/pvm.h @@ -26,6 +26,7 @@ #include #include "ios.h" +#include "pkl-compiler.h" /* **************** Status Codes **************** */ @@ -673,8 +674,6 @@ void pvm_set_oacutoff (pvm vm, unsigned int cutoff); It there is no compiler associated with VM, pvm_compiler returns NULL. */ -typedef struct pkl_compiler *pkl_compiler; - pkl_compiler pvm_compiler (pvm vm); void pvm_set_compiler (pvm vm, pkl_compiler compiler); -- 2.7.4