Skip to content

Commit

Permalink
peg: cast to (void *) in PCC_FREE
Browse files Browse the repository at this point in the history
This may be cause an error when compiling generated .c files
with mvc.

Signed-off-by: Masatake YAMATO <[email protected]>
  • Loading branch information
masatake committed Apr 8, 2021
1 parent ae30dd4 commit f34fe2f
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 10 deletions.
6 changes: 2 additions & 4 deletions peg/kotlin_pre.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,14 @@
#include "numarray.h"
#include "kind.h"
#include "read.h"
#include "peg_common.h"


/*
* MACROS
*/
#undef PCC_GETCHAR
#define PCC_GETCHAR(auxil) getcFromKotlinFile(auxil)
#define PCC_MALLOC(auxil,size) eMalloc(size)
#define PCC_REALLOC(auxil,ptr,size) eRealloc(ptr,size)
#define PCC_FREE(auxil,ptr) eFreeNoNullCheck(ptr)
#define PCC_ERROR(auxil) reportError(auxil)

/*
* DATA DECLARATIONS
Expand Down
19 changes: 19 additions & 0 deletions peg/peg_common.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* Copyright (c) 2021 Masatake YAMATO
*
* This source code is released for free distribution under the terms of the
* GNU General Public License version 2 or (at your option) any later version.
*
* This module contains macros, data decls and prototypes to generate tags for Kotlin.
*/

#ifndef CTAGS_PEG_COMMON
#define CTAGS_PEG_COMMON

#define PCC_GETCHAR(auxil) getcFromInputFile()
#define PCC_MALLCO(auxil,size) eMalloc(size)
#define PCC_REALLOC(auxil,ptr,size) eRealloc(ptr,size)
#define PCC_FREE(auxil,ptr) eFreeNoNullCheck((void *)ptr)
#define PCC_ERROR(auxil) reportError(auxil)

#endif /* !CTAGS_PEG_COMMON */
6 changes: 1 addition & 5 deletions peg/varlink_pre.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,12 @@
#include "numarray.h"
#include "kind.h"
#include "read.h"
#include "peg_common.h"


/*
* MACROS
*/
#define PCC_GETCHAR(auxil) getcFromInputFile()
#define PCC_MALLCO(auxil,size) eMalloc(size)
#define PCC_REALLOC(auxil,ptr,size) eRealloc(ptr,size)
#define PCC_FREE(auxil,ptr) eFreeNoNullCheck(ptr)
#define PCC_ERROR(auxil) reportError(auxil)

/*
* DATA DECLARATIONS
Expand Down
2 changes: 1 addition & 1 deletion source.mak
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ OPTLIB2C_SRCS = $(OPTLIB2C_INPUT:.ctags=.c)
include makefiles/peg_input.mak
PEG_SRCS = $(PEG_INPUT:.peg=.c)
PEG_HEADS = $(PEG_INPUT:.peg=.h)
PEG_EXTRA_HEADS = $(PEG_INPUT:.peg=_pre.h) $(PEG_INPUT:.peg=_post.h)
PEG_EXTRA_HEADS = peg/peg_common.h $(PEG_INPUT:.peg=_pre.h) $(PEG_INPUT:.peg=_post.h)
PEG_OBJS = $(PEG_SRCS:.c=.$(OBJEXT))

PARSER_HEADS = \
Expand Down

0 comments on commit f34fe2f

Please sign in to comment.