fix gettimeofday on windows and add __UNUSED__ for unused parameters

SVN revision: 34245
This commit is contained in:
doursse 2008-04-11 05:59:42 +00:00 committed by doursse
parent abfa4b4cd8
commit 9817e365b1
10 changed files with 65 additions and 49 deletions

View File

@ -29,10 +29,6 @@ SNAP=`echo $PACKAGE_VERSION | awk -F. '{printf("%s", $4);}'`
version_info=`expr $VMAJ + $VMIN`":$VMIC:$VMIN"
AC_SUBST(version_info)
AC_FUNC_ALLOCA
AC_CHECK_FUNCS(gettimeofday)
WIN32_CFLAGS=""
create_shared_lib=""
case "$host_os" in
@ -41,15 +37,36 @@ case "$host_os" in
AC_DEFINE(HAVE_EVIL, 1, [Set to 1 if evil package is installed])
dnl needed for correct definition of EAPI
AC_DEFINE(EFL_EMBRYO_BUILD, 1, [Define to mention that embryo is built])
AC_DEFINE(HAVE_GETTIMEOFDAY, 1, [Defined to 1 (MinGW / CeGCC platform)])
if test "x$host_os" = "xcegcc" ; then
WIN32_CFLAGS="-mwin32"
fi
create_shared_lib="-no-undefined"
;;
*)
AC_CHECK_FUNCS(gettimeofday)
esac
AC_SUBST(WIN32_CFLAGS)
AC_SUBST(create_shared_lib)
dnl Checking for __attribute__ support
AC_MSG_CHECKING([for __attribute__])
AC_CACHE_VAL(have___attribute__,
[
AC_TRY_COMPILE([#include <stdlib.h>],
[int func(int x); int foo(int x __attribute__ ((unused))) { exit(1); }],
[have___attribute__="yes"],
[have___attribute__="no"])
]
)
if test "x${have___attribute__}" = "xyes" ; then
AC_DEFINE(HAVE___ATTRIBUTE__, 1, [Define to 1 if your compiler has __attribute__])
fi
AC_MSG_RESULT(${have___attribute__})
AC_FUNC_ALLOCA
AC_CHECK_HEADERS(fnmatch.h,, AC_MSG_ERROR([Cannot find fnmatch.h. Make sure your CFLAGS environment variable contains include lines for the location of this file]))
fnmatch_libs=""

View File

@ -29,6 +29,7 @@
*/
#ifndef EMBRYO_CC_SC_H
#define EMBRYO_CC_SC_H
#include <limits.h>
#include <stdarg.h>
#include <stdio.h>
@ -36,6 +37,12 @@
#include "embryo_cc_osdefs.h"
#include "embryo_cc_amx.h"
#if HAVE___ATTRIBUTE__
#define __UNUSED__ __attribute__((unused))
#else
#define __UNUSED__
#endif
/* Note: the "cell" and "ucell" types are defined in AMX.H */
#define PUBLIC_CHAR '@' /* character that defines a function "public" */

View File

@ -116,7 +116,7 @@ static int *wqptr; /* pointer to next entry */
static char binfname[_MAX_PATH]; /* binary file name */
int
main(int argc, char *argv[], char *env[])
main(int argc, char *argv[], char *env[] __UNUSED__)
{
char argv0[_MAX_PATH];
int i;
@ -597,7 +597,7 @@ initglobals(void)
static void
parseoptions(int argc, char **argv, char *iname, char *oname,
char *pname, char *rname)
char *pname __UNUSED__, char *rname __UNUSED__)
{
char str[PATH_MAX];
int i, stack_size;

View File

@ -215,7 +215,7 @@ endexpr(int fullexpr)
* Global references: funcstatus (referred to only)
*/
void
startfunc(char *fname)
startfunc(char *fname __UNUSED__)
{
stgwrite("\tproc");
stgwrite("\n");

View File

@ -209,8 +209,9 @@ write_encoded(FILE * fbin, ucell * c, int num)
#if defined __BORLANDC__ || defined __WATCOMC__
#pragma argsused
#endif
static cell
noop(FILE * fbin, char *params, cell opcode)
noop(FILE * fbin __UNUSED__, char *params __UNUSED__, cell opcode __UNUSED__)
{
return 0;
}
@ -218,8 +219,9 @@ noop(FILE * fbin, char *params, cell opcode)
#if defined __BORLANDC__ || defined __WATCOMC__
#pragma argsused
#endif
static cell
parm0(FILE * fbin, char *params, cell opcode)
parm0(FILE * fbin, char *params __UNUSED__, cell opcode)
{
if (fbin != NULL)
write_encoded(fbin, (ucell *) & opcode, 1);
@ -257,8 +259,9 @@ parm2(FILE * fbin, char *params, cell opcode)
#if defined __BORLANDC__ || defined __WATCOMC__
#pragma argsused
#endif
static cell
do_dump(FILE * fbin, char *params, cell opcode)
do_dump(FILE * fbin, char *params, cell opcode __UNUSED__)
{
ucell p;
int num = 0;
@ -422,8 +425,9 @@ do_switch(FILE * fbin, char *params, cell opcode)
#if defined __BORLANDC__ || defined __WATCOMC__
#pragma argsused
#endif
static cell
do_case(FILE * fbin, char *params, cell opcode)
do_case(FILE * fbin, char *params, cell opcode __UNUSED__)
{
int i;
ucell p, v;
@ -445,8 +449,9 @@ do_case(FILE * fbin, char *params, cell opcode)
#if defined __BORLANDC__ || defined __WATCOMC__
#pragma argsused
#endif
static cell
curfile(FILE * fbin, char *params, cell opcode)
curfile(FILE * fbin __UNUSED__, char *params, cell opcode __UNUSED__)
{
fcurrent = (int)hex2long(params, NULL);
return 0;

View File

@ -12,7 +12,7 @@
/* exported args api */
static Embryo_Cell
_embryo_args_numargs(Embryo_Program *ep, Embryo_Cell *params)
_embryo_args_numargs(Embryo_Program *ep, Embryo_Cell *params __UNUSED__)
{
Embryo_Header *hdr;
unsigned char *data;

View File

@ -60,7 +60,7 @@ _embryo_fp_degrees_to_radians(float angle, int radix)
/* exported float api */
static Embryo_Cell
_embryo_fp(Embryo_Program *ep, Embryo_Cell *params)
_embryo_fp(Embryo_Program *ep __UNUSED__, Embryo_Cell *params)
{
/* params[1] = long value to convert to a float */
float f;
@ -89,7 +89,7 @@ _embryo_fp_str(Embryo_Program *ep, Embryo_Cell *params)
}
static Embryo_Cell
_embryo_fp_mul(Embryo_Program *ep, Embryo_Cell *params)
_embryo_fp_mul(Embryo_Program *ep __UNUSED__, Embryo_Cell *params)
{
/* params[1] = float operand 1 */
/* params[2] = float operand 2 */
@ -101,7 +101,7 @@ _embryo_fp_mul(Embryo_Program *ep, Embryo_Cell *params)
}
static Embryo_Cell
_embryo_fp_div(Embryo_Program *ep, Embryo_Cell *params)
_embryo_fp_div(Embryo_Program *ep __UNUSED__, Embryo_Cell *params)
{
/* params[1] = float dividend (top) */
/* params[2] = float divisor (bottom) */
@ -113,7 +113,7 @@ _embryo_fp_div(Embryo_Program *ep, Embryo_Cell *params)
}
static Embryo_Cell
_embryo_fp_add(Embryo_Program *ep, Embryo_Cell *params)
_embryo_fp_add(Embryo_Program *ep __UNUSED__, Embryo_Cell *params)
{
/* params[1] = float operand 1 */
/* params[2] = float operand 2 */
@ -125,7 +125,7 @@ _embryo_fp_add(Embryo_Program *ep, Embryo_Cell *params)
}
static Embryo_Cell
_embryo_fp_sub(Embryo_Program *ep, Embryo_Cell *params)
_embryo_fp_sub(Embryo_Program *ep __UNUSED__, Embryo_Cell *params)
{
/* params[1] = float operand 1 */
/* params[2] = float operand 2 */
@ -138,7 +138,7 @@ _embryo_fp_sub(Embryo_Program *ep, Embryo_Cell *params)
/* Return fractional part of float */
static Embryo_Cell
_embryo_fp_fract(Embryo_Program *ep, Embryo_Cell *params)
_embryo_fp_fract(Embryo_Program *ep __UNUSED__, Embryo_Cell *params)
{
/* params[1] = float operand */
float f;
@ -151,7 +151,7 @@ _embryo_fp_fract(Embryo_Program *ep, Embryo_Cell *params)
/* Return integer part of float, rounded */
static Embryo_Cell
_embryo_fp_round(Embryo_Program *ep, Embryo_Cell *params)
_embryo_fp_round(Embryo_Program *ep __UNUSED__, Embryo_Cell *params)
{
/* params[1] = float operand */
/* params[2] = Type of rounding (cell) */
@ -179,7 +179,7 @@ _embryo_fp_round(Embryo_Program *ep, Embryo_Cell *params)
}
static Embryo_Cell
_embryo_fp_cmp(Embryo_Program *ep, Embryo_Cell *params)
_embryo_fp_cmp(Embryo_Program *ep __UNUSED__, Embryo_Cell *params)
{
/* params[1] = float operand 1 */
/* params[2] = float operand 2 */
@ -211,7 +211,7 @@ _embryo_fp_sqroot(Embryo_Program *ep, Embryo_Cell *params)
}
static Embryo_Cell
_embryo_fp_power(Embryo_Program *ep, Embryo_Cell *params)
_embryo_fp_power(Embryo_Program *ep __UNUSED__, Embryo_Cell *params)
{
/* params[1] = float operand 1 */
/* params[2] = float operand 2 */
@ -245,7 +245,7 @@ _embryo_fp_log(Embryo_Program *ep, Embryo_Cell *params)
}
static Embryo_Cell
_embryo_fp_sin(Embryo_Program *ep, Embryo_Cell *params)
_embryo_fp_sin(Embryo_Program *ep __UNUSED__, Embryo_Cell *params)
{
/* params[1] = float operand 1 (angle) */
/* params[2] = float operand 2 (radix) */
@ -259,7 +259,7 @@ _embryo_fp_sin(Embryo_Program *ep, Embryo_Cell *params)
}
static Embryo_Cell
_embryo_fp_cos(Embryo_Program *ep, Embryo_Cell *params)
_embryo_fp_cos(Embryo_Program *ep __UNUSED__, Embryo_Cell *params)
{
/* params[1] = float operand 1 (angle) */
/* params[2] = float operand 2 (radix) */
@ -273,7 +273,7 @@ _embryo_fp_cos(Embryo_Program *ep, Embryo_Cell *params)
}
static Embryo_Cell
_embryo_fp_tan(Embryo_Program *ep, Embryo_Cell *params)
_embryo_fp_tan(Embryo_Program *ep __UNUSED__, Embryo_Cell *params)
{
/* params[1] = float operand 1 (angle) */
/* params[2] = float operand 2 (radix) */
@ -287,7 +287,7 @@ _embryo_fp_tan(Embryo_Program *ep, Embryo_Cell *params)
}
static Embryo_Cell
_embryo_fp_abs(Embryo_Program *ep, Embryo_Cell *params)
_embryo_fp_abs(Embryo_Program *ep __UNUSED__, Embryo_Cell *params)
{
/* params[1] = float operand */
float f;

View File

@ -39,6 +39,12 @@ void *alloca (size_t);
# endif
#endif
#if HAVE___ATTRIBUTE__
#define __UNUSED__ __attribute__((unused))
#else
#define __UNUSED__
#endif
typedef enum _Embryo_Opcode Embryo_Opcode;
enum _Embryo_Opcode

View File

@ -3,13 +3,13 @@
/* exported random number api */
static Embryo_Cell
_embryo_rand_rand(Embryo_Program *ep, Embryo_Cell *params)
_embryo_rand_rand(Embryo_Program *ep __UNUSED__, Embryo_Cell *params __UNUSED__)
{
return (Embryo_Cell)(rand() & 0xffff);
}
static Embryo_Cell
_embryo_rand_randf(Embryo_Program *ep, Embryo_Cell *params)
_embryo_rand_randf(Embryo_Program *ep __UNUSED__, Embryo_Cell *params __UNUSED__)
{
double r;
float f;

View File

@ -6,32 +6,13 @@
#include <time.h>
#ifndef HAVE_GETTIMEOFDAY
#ifdef WIN32
#include <sys/timeb.h>
static int gettimeofday (struct timeval *tv, void *unused)
{
struct _timeb t;
if (!tv)
return -1;
_ftime (&t);
tv->tv_sec = t.time;
tv->tv_usec = t.millitm * 1000;
return 0;
}
#else
#error "Your platform isn't supported yet"
#endif
# error "Your platform isn't supported yet"
#endif
/* exported time api */
static Embryo_Cell
_embryo_time_seconds(Embryo_Program *ep, Embryo_Cell *params)
_embryo_time_seconds(Embryo_Program *ep __UNUSED__, Embryo_Cell *params __UNUSED__)
{
struct timeval timev;
double t;