PERFORCE change 163266 for review
Gabor Kovesdan
gabor at FreeBSD.org
Mon Jun 1 15:00:23 UTC 2009
http://perforce.freebsd.org/chv.cgi?CH=163266
Change 163266 by gabor at gabor_server on 2009/06/01 14:59:34
- Make this WARNS=6 clean
Affected files ...
.. //depot/projects/soc2008/gabor_textproc/dc/Makefile#2 edit
.. //depot/projects/soc2008/gabor_textproc/dc/bcode.c#2 edit
.. //depot/projects/soc2008/gabor_textproc/dc/bcode.h#2 edit
.. //depot/projects/soc2008/gabor_textproc/dc/dc.c#2 edit
.. //depot/projects/soc2008/gabor_textproc/dc/inout.c#2 edit
.. //depot/projects/soc2008/gabor_textproc/dc/stack.c#2 edit
Differences ...
==== //depot/projects/soc2008/gabor_textproc/dc/Makefile#2 (text+ko) ====
@@ -2,9 +2,9 @@
PROG= dc
SRCS= dc.c bcode.c inout.c mem.c stack.c
-COPTS+= -Wall
-CFLAGS+= -std=c99 -Wall -pedantic
LDADD= -lcrypto
DPADD= ${LIBCRYPTO}
+WARNS?= 6
+
.include <bsd.prog.mk>
==== //depot/projects/soc2008/gabor_textproc/dc/bcode.c#2 (text+ko) ====
@@ -34,6 +34,8 @@
/* #define DEBUGGING */
+#define __inline
+
#define MAX_ARRAY_INDEX 2048
#define READSTACK_SIZE 8
@@ -58,26 +60,26 @@
static struct bmachine bmachine;
static void sighandler(int);
-static inline int readch(void);
-static inline void unreadch(void);
-static inline char *readline(void);
-static inline void src_free(void);
+static __inline int readch(void);
+static __inline void unreadch(void);
+static __inline char *readline(void);
+static __inline void src_free(void);
-static inline u_int max(u_int, u_int);
+static __inline u_int max(u_int, u_int);
static u_long get_ulong(struct number *);
-static inline void push_number(struct number *);
-static inline void push_string(char *);
-static inline void push(struct value *);
-static inline struct value *tos(void);
-static inline struct number *pop_number(void);
-static inline char *pop_string(void);
-static inline void clear_stack(void);
-static inline void print_tos(void);
+static __inline void push_number(struct number *);
+static __inline void push_string(char *);
+static __inline void push(struct value *);
+static __inline struct value *tos(void);
+static __inline struct number *pop_number(void);
+static __inline char *pop_string(void);
+static __inline void clear_stack(void);
+static __inline void print_tos(void);
static void pop_print(void);
static void pop_printn(void);
-static inline void print_stack(void);
-static inline void dup(void);
+static __inline void print_stack(void);
+static __inline void dup(void);
static void swap(void);
static void drop(void);
@@ -223,18 +225,21 @@
#define JUMP_TABLE_DATA_SIZE \
(sizeof(jump_table_data)/sizeof(jump_table_data[0]))
-/* ARGSUSED */
static void
sighandler(int ignored)
{
- bmachine.interrupted = true;
+ switch (ignored)
+ {
+ default:
+ bmachine.interrupted = true;
+ }
}
void
init_bmachine(bool extended_registers)
{
- int i;
+ unsigned int i;
bmachine.extended_regs = extended_registers;
bmachine.reg_array_size = bmachine.extended_regs ?
@@ -275,7 +280,7 @@
bmachine.readstack[0] = *src;
}
-static inline int
+static __inline int
readch(void)
{
struct source *src = &bmachine.readstack[bmachine.readsp];
@@ -283,7 +288,7 @@
return (src->vtable->readchar(src));
}
-static inline void
+static __inline void
unreadch(void)
{
struct source *src = &bmachine.readstack[bmachine.readsp];
@@ -291,7 +296,7 @@
src->vtable->unreadchar(src);
}
-static inline char *
+static __inline char *
readline(void)
{
struct source *src = &bmachine.readstack[bmachine.readsp];
@@ -299,7 +304,7 @@
return (src->vtable->readline(src));
}
-static inline void
+static __inline void
src_free(void)
{
struct source *src = &bmachine.readstack[bmachine.readsp];
@@ -332,7 +337,7 @@
#endif
-static inline u_int
+static __inline u_int
max(u_int a, u_int b)
{
@@ -347,7 +352,7 @@
void
scale_number(BIGNUM *n, int s)
{
- int abs_scale;
+ unsigned int abs_scale;
if (s == 0)
return;
@@ -417,7 +422,7 @@
}
}
-inline void
+__inline void
normalize(struct number *n, u_int s)
{
@@ -440,70 +445,70 @@
bn_check(BN_sub(n->number, &zero, n->number));
}
-static inline void
+static __inline void
push_number(struct number *n)
{
stack_pushnumber(&bmachine.stack, n);
}
-static inline void
+static __inline void
push_string(char *string)
{
stack_pushstring(&bmachine.stack, string);
}
-static inline void
+static __inline void
push(struct value *v)
{
stack_push(&bmachine.stack, v);
}
-static inline struct value *
+static __inline struct value *
tos(void)
{
return (stack_tos(&bmachine.stack));
}
-static inline struct value *
+static __inline struct value *
pop(void)
{
return (stack_pop(&bmachine.stack));
}
-static inline struct number *
+static __inline struct number *
pop_number(void)
{
return (stack_popnumber(&bmachine.stack));
}
-static inline char *
+static __inline char *
pop_string(void)
{
return (stack_popstring(&bmachine.stack));
}
-static inline void
+static __inline void
clear_stack(void)
{
stack_clear(&bmachine.stack);
}
-static inline void
+static __inline void
print_stack(void)
{
stack_print(stdout, &bmachine.stack, "", bmachine.obase);
}
-static inline void
+static __inline void
print_tos(void)
{
struct value *value = tos();
@@ -550,7 +555,7 @@
}
}
-static inline void
+static __inline void
dup(void)
{
@@ -792,7 +797,7 @@
} else
idx = (ch1 << 8) + ch2 + UCHAR_MAX + 1;
}
- if (idx < 0 || idx >= bmachine.reg_array_size) {
+ if (idx < 0 || (unsigned)idx >= bmachine.reg_array_size) {
warnx("internal error: reg num = %d", idx);
idx = -1;
}
@@ -1762,7 +1767,7 @@
fprintf(stderr, "%zd =>\n", bmachine.readsp);
#endif
- if (0 <= ch && ch < UCHAR_MAX)
+ if (0 <= ch && ch < (signed)UCHAR_MAX)
(*jump_table[ch])();
else
warnx("internal error: opcode %d", ch);
==== //depot/projects/soc2008/gabor_textproc/dc/bcode.h#2 (text+ko) ====
@@ -59,7 +59,7 @@
struct stack {
struct value *stack;
ssize_t sp;
- size_t size;
+ ssize_t size;
};
struct source;
==== //depot/projects/soc2008/gabor_textproc/dc/dc.c#2 (text+ko) ====
@@ -83,7 +83,7 @@
{
int ch;
bool extended_regs = false;
- char *buf, *p;
+ char *buf;
bool preproc_done = false;
if ((buf = strdup("")) == NULL)
==== //depot/projects/soc2008/gabor_textproc/dc/inout.c#2 (text+ko) ====
@@ -35,7 +35,6 @@
static int src_getcharstream(struct source *);
static void src_ungetcharstream(struct source *);
static char *src_getlinestream(struct source *);
-static void src_freestream(struct source *);
static int src_getcharstring(struct source *);
static void src_ungetcharstring(struct source *);
static char *src_getlinestring(struct source *);
@@ -49,7 +48,7 @@
src_getcharstream,
src_ungetcharstream,
src_getlinestream,
- src_freestream
+ NULL
};
static struct vtable string_vtable = {
@@ -86,12 +85,6 @@
ungetc(src->lastchar, src->u.stream);
}
-/* ARGSUSED */
-static void
-src_freestream(struct source *src)
-{
-}
-
static char *
src_getlinestream(struct source *src)
{
@@ -293,7 +286,7 @@
int digits;
char buf[11];
size_t sz;
- int i;
+ unsigned int i;
struct stack stack;
char *p;
==== //depot/projects/soc2008/gabor_textproc/dc/stack.c#2 (text+ko) ====
@@ -26,14 +26,14 @@
#include "extern.h"
-static inline bool stack_empty(const struct stack *);
+static __inline bool stack_empty(const struct stack *);
static void stack_grow(struct stack *);
static struct array *array_new(void);
-static inline void array_free(struct array *);
+static __inline void array_free(struct array *);
static struct array * array_dup(const struct array *);
-static inline void array_grow(struct array *, size_t);
-static inline void array_assign(struct array *, size_t, const struct value *);
-static inline struct value *array_retrieve(const struct array *, size_t);
+static __inline void array_grow(struct array *, size_t);
+static __inline void array_assign(struct array *, size_t, const struct value *);
+static __inline struct value *array_retrieve(const struct array *, size_t);
void
stack_init(struct stack *stack)
@@ -43,7 +43,7 @@
stack->stack = NULL;
}
-static inline bool
+static __inline bool
stack_empty(const struct stack *stack)
{
bool empty = stack->sp == -1;
@@ -274,7 +274,7 @@
return a;
}
-static inline void
+static __inline void
array_free(struct array *a)
{
size_t i;
@@ -302,7 +302,7 @@
return n;
}
-static inline void
+static __inline void
array_grow(struct array *array, size_t newsize)
{
size_t i;
@@ -315,25 +315,25 @@
array->size = newsize;
}
-static inline void
-array_assign(struct array *array, size_t index, const struct value *v)
+static __inline void
+array_assign(struct array *array, size_t i, const struct value *v)
{
- if (index >= array->size)
- array_grow(array, index+1);
- stack_free_value(&array->data[index]);
- array->data[index] = *v;
+ if (i >= array->size)
+ array_grow(array, i + 1);
+ stack_free_value(&array->data[i]);
+ array->data[i] = *v;
}
-static inline struct value *
-array_retrieve(const struct array *array, size_t index)
+static __inline struct value *
+array_retrieve(const struct array *array, size_t i)
{
- if (index >= array->size)
+ if (i >= array->size)
return NULL;
- return &array->data[index];
+ return &array->data[i];
}
void
-frame_assign(struct stack *stack, size_t index, const struct value *v)
+frame_assign(struct stack *stack, size_t i, const struct value *v)
{
struct array *a;
struct value n;
@@ -347,11 +347,11 @@
a = stack->stack[stack->sp].array;
if (a == NULL)
a = stack->stack[stack->sp].array = array_new();
- array_assign(a, index, v);
+ array_assign(a, i, v);
}
struct value *
-frame_retrieve(const struct stack *stack, size_t index)
+frame_retrieve(const struct stack *stack, size_t i)
{
struct array *a;
@@ -360,5 +360,5 @@
a = stack->stack[stack->sp].array;
if (a == NULL)
a = stack->stack[stack->sp].array = array_new();
- return array_retrieve(a, index);
+ return array_retrieve(a, i);
}
More information about the p4-projects
mailing list