clang fixes

This commit is contained in:
Vítor Santos Costa 2013-11-15 10:38:00 +00:00
parent 6de15433aa
commit 3c7656b619
7 changed files with 48 additions and 14 deletions

View File

@ -18,13 +18,18 @@
#include "config.h"
#include "YapInterface.h"
#if HAVE_STDINT_H
#include <stdint.h>
#endif
#include <stdlib.h>
#include <stddef.h>
#include "pl-shared.h"
#ifdef _MSC_VER /* Microsoft's Visual C++ Compiler */
#ifdef HAVE_UNISTD_H
#undef HAVE_UNISTD_H
#endif
#endif
#include <stdlib.h>
#include <stdio.h>
#if HAVE_STRING_H
#include <string.h>
@ -201,6 +206,8 @@ YAP_parse_yap_arguments(int argc, char *argv[], YAP_init_args *iap)
iap->ErrorCause = NULL;
iap->QuietMode = FALSE;
GD->cmdline.os_argc = argc;
GD->cmdline.os_argv = argv;
while (--argc > 0)
{
p = *++argv;
@ -553,5 +560,7 @@ YAP_parse_yap_arguments(int argc, char *argv[], YAP_init_args *iap)
goto myddas_error;
}
#endif
GD->cmdline.appl_argc = argc;
GD->cmdline.appl_argv = argv;
return BootMode;
}

View File

@ -59,21 +59,37 @@ typedef int pthread_t;
#if !defined(_FLI_H_INCLUDED)
typedef int bool;
typedef int bool;
/* this must be called if we're not including SWI-Prolog first */
/* should be a copy of what we can find in SWI-Prolog.h */
typedef struct DB_STRUCT *record_t;
typedef struct mod_entry *module_t;
#ifndef PL_HAVE_TERM_T
#define PL_HAVE_TERM_T
typedef uintptr_t term_t;
#endif
typedef struct mod_entry *module_t;
typedef struct DB_STRUCT *record_t;
typedef uintptr_t atom_t;
typedef struct pred_entry *predicate_t;
typedef struct open_query_struct *qid_t;
typedef uintptr_t functor_t;
typedef int (*PL_agc_hook_t)(atom_t);
typedef unsigned long foreign_t; /* return type of foreign functions */
typedef wchar_t pl_wchar_t; /* wide character support */
#include <inttypes.h> /* more portable than stdint.h */
#if !defined(_MSC_VER)
typedef uintptr_t PL_fid_t; /* opaque foreign context handle */
#endif
typedef int (*PL_dispatch_hook_t)(int fd);
typedef struct pred_entry *predicate_t;
typedef uintptr_t PL_fid_t; /* opaque foreign context handle */
#define O_STRING 1
typedef void *pl_function_t;
#define fid_t PL_fid_t /* avoid AIX name-clash */
typedef uintptr_t word; /* Anonymous 4 byte object */
#endif
#ifndef COMMON

View File

@ -1,3 +1,4 @@
#include <setjmp.h>
typedef enum
{ DBG_OFF = 0, /* no debugging */

View File

@ -3,6 +3,10 @@
#define PL_INCL_H 1
/* define that we are in the pl-* code */
#define _PL_EMULATION_LAYER 1
#include "config.h"
#if HAVE_ERRNO_H
@ -57,7 +61,6 @@ do_endCritical(void) {
#include <SWI-Stream.h>
#include <SWI-Prolog.h>
typedef int bool;
typedef int Char; /* char that can pass EOF */
typedef uintptr_t word; /* Anonymous 4 byte object */
@ -796,6 +799,7 @@ COMMON(word) pl_prolog_flag5(term_t key, term_t value, word scope, word access,
COMMON(foreign_t) pl_prolog_flag(term_t name, term_t value, control_t h);
COMMON(struct tm *) PL_localtime_r(const time_t *t, struct tm *r);
COMMON(char *) PL_asctime_r(const struct tm *tm, char *buf);
#define PL_unify(t1, t2) PL_unify__LD(t1, t2 PASS_LD)
@ -837,6 +841,8 @@ static inline void freeHeap(void *mem, size_t n)
YAP_FreeSpaceFromYap(mem);
}
extern void unallocStream(IOSTREAM *s);
extern atom_t accessLevel(void);
int currentBreakLevel(void);

View File

@ -134,6 +134,8 @@ typedef unsigned long uintptr_t;
#include <inttypes.h> /* more portable than stdint.h */
#endif
#ifndef PL_BASIC_H
#ifndef PL_HAVE_TERM_T
#define PL_HAVE_TERM_T
typedef uintptr_t term_t;
@ -151,6 +153,8 @@ typedef wchar_t pl_wchar_t; /* wide character support */
#if !defined(_MSC_VER)
typedef uintptr_t PL_fid_t; /* opaque foreign context handle */
#endif
typedef int (*PL_dispatch_hook_t)(int fd);
#define O_STRING 1
@ -158,6 +162,8 @@ typedef void *pl_function_t;
#define fid_t PL_fid_t /* avoid AIX name-clash */
#endif
typedef struct _PL_extension
{ const char *predicate_name; /* Name of the predicate */
short arity; /* Arity of the predicate */
@ -656,8 +662,6 @@ readline overhead.
#define PL_DISPATCH_WAIT 1 /* Dispatch till input available */
#define PL_DISPATCH_INSTALLED 2 /* dispatch function installed? */
typedef int (*PL_dispatch_hook_t)(int fd);
extern X_API int PL_dispatch(int fd, int wait);
PL_EXPORT(PL_dispatch_hook_t) PL_dispatch_hook(PL_dispatch_hook_t);
PL_EXPORT(void) PL_add_to_protocol(const char *buf, size_t count);

View File

@ -415,9 +415,6 @@ Sread_readline(void *handle, char *buf, size_t size)
int fd = (int) h;
int ttymode = PL_ttymode(Suser_input); /* Not so nice */
int rval;
#ifdef HAVE_CLOCK
intptr_t oldclock = clock();
#endif
PL_write_prompt(ttymode == PL_NOTTY);

View File

@ -1924,6 +1924,7 @@ Svprintf(const char *fm, va_list args)
break; \
} \
default: \
c = '\0'; \
break; \
}