explicit casts, add includes

This commit is contained in:
Joseph Poirier 2015-06-17 16:57:50 -05:00
parent 97fbbaaf8f
commit 011ee0f3eb
11 changed files with 21 additions and 17 deletions

View file

@ -1,4 +1,5 @@
/* */
#include <math.h>
#include "../interpreter.h"

View file

@ -1,4 +1,5 @@
/* */
#include <stdbool.h>
#include "../interpreter.h"

View file

@ -1,10 +1,10 @@
/* */
#include <stdio.h>
#include <errno.h>
#include "../interpreter.h"
#define MAX_FORMAT 80
#define MAX_SCANF_ARGS 10
#define MAX_FORMAT (80)
#define MAX_SCANF_ARGS (10)
static int Stdio_ZeroValue = 0;
static int EOFValue = EOF;

View file

@ -1,4 +1,5 @@
/* */
#include <stdlib.h>
#include "../interpreter.h"

View file

@ -1,4 +1,5 @@
/* */
#include <string.h>
#include "../interpreter.h"
@ -176,13 +177,13 @@ void StringStrxfrm(struct ParseState *Parser, struct Value *ReturnValue,
void StringStrdup(struct ParseState *Parser, struct Value *ReturnValue,
struct Value **Param, int NumArgs)
{
ReturnValue->Val->Pointer = strdup(Param[0]->Val->Pointer);
ReturnValue->Val->Pointer = (void*)strdup(Param[0]->Val->Pointer);
}
void StringStrtok_r(struct ParseState *Parser, struct Value *ReturnValue,
struct Value **Param, int NumArgs)
{
ReturnValue->Val->Pointer = strtok_r(Param[0]->Val->Pointer,
ReturnValue->Val->Pointer = (void*)strtok_r(Param[0]->Val->Pointer,
Param[1]->Val->Pointer, Param[2]->Val->Pointer);
}
#endif

View file

@ -82,7 +82,7 @@ void StdStrptime(struct ParseState *Parser, struct Value *ReturnValue,
void StdGmtime_r(struct ParseState *Parser, struct Value *ReturnValue,
struct Value **Param, int NumArgs)
{
ReturnValue->Val->Pointer = gmtime_r(Param[0]->Val->Pointer,
ReturnValue->Val->Pointer = (void*)gmtime_r(Param[0]->Val->Pointer,
Param[1]->Val->Pointer);
}

View file

@ -192,7 +192,7 @@ void UnistdGetpagesize(struct ParseState *Parser, struct Value *ReturnValue,
void UnistdGetpass(struct ParseState *Parser, struct Value *ReturnValue,
struct Value **Param, int NumArgs)
{
ReturnValue->Val->Pointer = getpass(Param[0]->Val->Pointer);
ReturnValue->Val->Pointer = (void*)getpass(Param[0]->Val->Pointer);
}
#if 0

View file

@ -749,7 +749,7 @@ void ExpressionPrefixOperator(struct ParseState *Parser,
/* pointer prefix arithmetic */
int Size = TypeSize(TopValue->Typ->FromType, 0, true);
struct Value *StackValue;
void *ResultPtr;
void *ResultPtr = 0;
if (Op != TokenUnaryNot && TopValue->Val->Pointer == NULL)
ProgramFail(Parser, "a. invalid use of a NULL pointer");
if (!TopValue->IsLValue)

14
lex.c
View file

@ -54,13 +54,13 @@ struct ReservedWord {
static struct ReservedWord ReservedWords[] = {
/* wrf, when optimizations are set escaping certain chars is required or they disappear */
{"\#define", TokenHashDefine},
{"\#else", TokenHashElse},
{"\#endif", TokenHashEndif},
{"\#if", TokenHashIf},
{"\#ifdef", TokenHashIfdef},
{"\#ifndef", TokenHashIfndef},
{"\#include", TokenHashInclude},
{"#define", TokenHashDefine},
{"#else", TokenHashElse},
{"#endif", TokenHashEndif},
{"#if", TokenHashIf},
{"#ifdef", TokenHashIfdef},
{"#ifndef", TokenHashIfndef},
{"#include", TokenHashInclude},
{"auto", TokenAutoType},
{"break", TokenBreak},
{"case", TokenCase},

View file

@ -6,7 +6,7 @@
/* picoc version number */
#ifdef VER
/* VER is the git hash number, obtained via the Makefile */
/* VER, the git hash number, and TAG are obtained via the Makefile */
#define PICOC_VERSION TAG " r" VER
#else
#define PICOC_VERSION "v2.2"

View file

@ -50,7 +50,7 @@
#define ALIGN_TYPE double
#else
/* the default data type to use for alignment */
#define ALIGN_TYPE void *
#define ALIGN_TYPE void*
#endif
#define GLOBAL_TABLE_SIZE (97) /* global variable table */