>From 98710a202b7bbd1c3eb4f7479969cf9e37f886a2 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sat, 27 Feb 2021 22:50:56 +0100 Subject: [PATCH] Fix compilation errors with GCC < 4.6. * libpoke/pkl-env.h (pkl_env): Add double-definition guard. * libpoke/pkl.h (pkl_compiler, pkl_env): Likewise. * libpoke/pvm.h (pvm_program, pkl_compiler): Likewise. * libpoke/pvm-val.h (pvm_program, pvm_program_program_point): Likewise. * libpoke/pvm-program.h (pvm_program_program_point): Likewise. * libpoke/pkl-env.c (HASH_TABLE_SIZE, pkl_hash): Comment out definitions. --- libpoke/pkl-env.c | 2 ++ libpoke/pkl-env.h | 3 +++ libpoke/pkl.h | 6 ++++++ libpoke/pvm-program.h | 3 +++ libpoke/pvm-val.h | 6 ++++++ libpoke/pvm.h | 6 ++++++ 6 files changed, 26 insertions(+) diff --git a/libpoke/pkl-env.c b/libpoke/pkl-env.c index 782f022..98ccc74 100644 --- a/libpoke/pkl-env.c +++ b/libpoke/pkl-env.c @@ -43,8 +43,10 @@ UP is a link to the immediately enclosing frame. This is NULL for the top-level frame. */ +#if 0 /* defined in pkl-ast.h */ #define HASH_TABLE_SIZE 1008 typedef pkl_ast_node pkl_hash[HASH_TABLE_SIZE]; +#endif struct pkl_env { diff --git a/libpoke/pkl-env.h b/libpoke/pkl-env.h index ef162d2..f403013 100644 --- a/libpoke/pkl-env.h +++ b/libpoke/pkl-env.h @@ -55,7 +55,10 @@ are not generally available at compile-time. However, the type information is always available at compile-time. */ +#ifndef PKL_ENV_DEFINED +#define PKL_ENV_DEFINED typedef struct pkl_env *pkl_env; /* Struct defined in pkl-env.c */ +#endif /* Get an empty environment. */ diff --git a/libpoke/pkl.h b/libpoke/pkl.h index d016eac..ef9f33c 100644 --- a/libpoke/pkl.h +++ b/libpoke/pkl.h @@ -60,8 +60,11 @@ longer needed, in order to do some finalization tasks and free resources. */ +#ifndef PKL_COMPILER_DEFINED +#define PKL_COMPILER_DEFINED typedef struct pkl_compiler *pkl_compiler; /* This data structure is defined in pkl.c */ +#endif /* Initialization and finalization functions. */ @@ -140,7 +143,10 @@ pvm pkl_get_vm (pkl_compiler compiler); /* Return the current compile-time environment in COMPILER. */ +#ifndef PKL_ENV_DEFINED +#define PKL_ENV_DEFINED typedef struct pkl_env *pkl_env; /* Struct defined in pkl-env.c */ +#endif pkl_env pkl_get_env (pkl_compiler compiler); diff --git a/libpoke/pvm-program.h b/libpoke/pvm-program.h index d878ef7..ba06f7e 100644 --- a/libpoke/pvm-program.h +++ b/libpoke/pvm-program.h @@ -21,7 +21,10 @@ #include "pvm-vm.h" +#ifndef PVM_PROGRAM_PROGRAM_POINT_DEFINED +#define PVM_PROGRAM_PROGRAM_POINT_DEFINED typedef void *pvm_program_program_point; /* XXX better name */ +#endif /* Initialize and finalize the pvm-program subsystem. */ diff --git a/libpoke/pvm-val.h b/libpoke/pvm-val.h index 0c45f7d..dca133a 100644 --- a/libpoke/pvm-val.h +++ b/libpoke/pvm-val.h @@ -500,8 +500,14 @@ typedef struct pvm_type *pvm_type; #define PVM_VAL_CLS_ENTRY_POINT(V) (PVM_VAL_CLS((V))->entry_point) #define PVM_VAL_CLS_ENV(V) (PVM_VAL_CLS((V))->env) +#ifndef PKL_PROGRAM_DEFINED +#define PKL_PROGRAM_DEFINED typedef struct pvm_program *pvm_program; +#endif +#ifndef PVM_PROGRAM_PROGRAM_POINT_DEFINED +#define PVM_PROGRAM_PROGRAM_POINT_DEFINED typedef void *pvm_program_program_point; +#endif struct pvm_cls { diff --git a/libpoke/pvm.h b/libpoke/pvm.h index 30e9b7b..573264e 100644 --- a/libpoke/pvm.h +++ b/libpoke/pvm.h @@ -58,7 +58,10 @@ typedef uint64_t pvm_val; /* PVM programs are sequences of instructions, labels and directives, that can be run in the virtual machine. */ +#ifndef PKL_PROGRAM_DEFINED +#define PKL_PROGRAM_DEFINED typedef struct pvm_program *pvm_program; +#endif /* Each PVM program can contain zero or more labels. Labels are used as targets of branch instructions. */ @@ -673,7 +676,10 @@ void pvm_set_oacutoff (pvm vm, unsigned int cutoff); It there is no compiler associated with VM, pvm_compiler returns NULL. */ +#ifndef PKL_COMPILER_DEFINED +#define PKL_COMPILER_DEFINED typedef struct pkl_compiler *pkl_compiler; +#endif pkl_compiler pvm_compiler (pvm vm); -- 2.7.4