Commit 41e5bb26 authored by Anders Blomdell's avatar Anders Blomdell
Browse files

Various C99 compliance fixes.

parent a5deb387
......@@ -951,8 +951,7 @@ aspect C_Signature {
}
public void Program.C_emitConstructorDeclaration(C_env env) {
env.println("LABCOMM_CONSTRUCTOR void init_" +
env.prefix + "_signatures(void);");
env.println("void init_" + env.prefix + "_signatures(void);");
}
}
......
......@@ -2,7 +2,7 @@ TARGETS=client server
LABCOMM_JAR=../../compiler/labComm.jar
LABCOMM=java -jar $(LABCOMM_JAR)
CFLAGS=-O3 -g -Wall -Werror -I../../lib/c -I. -lpthread
CFLAGS=-O3 -g -Wall -Werror -I../../lib/c -I.
all: $(TARGETS:%=gen/%)
......@@ -26,11 +26,11 @@ gen/%.c gen/%.h: %.lc | gen/.dir
gen/client: client.c
$(CC) -o $@ $(CFLAGS) $^ -lpthread \
-L../../lib/c -llabcomm -Tlabcomm.linkscript
-L../../lib/c -llabcomm
gen/server: server.c
$(CC) -o $@ $(CFLAGS) $^ -lpthread \
-L../../lib/c -llabcomm -Tlabcomm.linkscript
-L../../lib/c -llabcomm
.PHONY: clean
clean:
......
......@@ -2,7 +2,7 @@
UNAME_S=$(shell uname -s)
ifeq ($(UNAME_S),Linux)
CC=gcc
CFLAGS=-g -Wall -Werror -O3 -I. -Itest
CFLAGS=-std=c99 -g -Wall -Werror -O3 -I. -Itest
LDFLAGS=-L.
LDLIBS=-llabcomm -lrt
MAKESHARED=gcc -o $1 -shared -Wl,-soname,$2 $3 -lc -lrt
......
......@@ -226,7 +226,7 @@ static int decode_typedef_or_sample(struct labcomm_decoder *d, int kind)
s->signature->type == signature.type &&
s->signature->size == signature.size &&
strcmp(s->signature->name, signature.name) == 0 &&
bcmp((void*)s->signature->signature, (void*)signature.signature,
memcmp((void*)s->signature->signature, (void*)signature.signature,
signature.size) == 0) {
s->remote_index = remote_index;
local_signature = s->signature;
......
......@@ -79,7 +79,7 @@ static int scheduler_wakeup(struct labcomm_scheduler *s)
}
static int scheduler_enqueue(struct labcomm_scheduler *s,
useconds_t delay,
uint32_t delay,
void (*deferred)(void *context),
void *context)
{
......
......@@ -18,6 +18,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#define _POSIX_C_SOURCE (200112L)
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
......@@ -64,7 +65,7 @@ static int queue_empty(struct pthread_deferred *queue)
return queue->next == queue;
}
static void timespec_add_usec(struct timespec *t, useconds_t usec)
static void timespec_add_usec(struct timespec *t, uint32_t usec)
{
time_t sec = usec / 1000000;
long nsec = (usec % 1000000) * 1000;
......@@ -125,7 +126,7 @@ static int time_free(struct labcomm_time *t)
return 0;
}
static int time_add_usec(struct labcomm_time *t, useconds_t usec)
static int time_add_usec(struct labcomm_time *t, uint32_t usec)
{
struct pthread_time *time = t->context;
......@@ -297,7 +298,7 @@ static int scheduler_wakeup(struct labcomm_scheduler *s)
}
static int scheduler_enqueue(struct labcomm_scheduler *s,
useconds_t delay,
uint32_t delay,
void (*deferred)(void *context),
void *context)
{
......
......@@ -75,7 +75,7 @@ int labcomm_scheduler_wakeup(struct labcomm_scheduler *s)
}
int labcomm_scheduler_enqueue(struct labcomm_scheduler *s,
useconds_t delay,
uint32_t delay,
void (*func)(void *context),
void *context)
{
......
......@@ -23,11 +23,12 @@
#define _LABCOMM_SCHEDULER_H_
#include <unistd.h>
#include <stdint.h>
struct labcomm_time;
int labcomm_time_free(struct labcomm_time *t);
int labcomm_time_add_usec(struct labcomm_time *t, useconds_t usec);
int labcomm_time_add_usec(struct labcomm_time *t, uint32_t usec);
struct labcomm_scheduler;
......@@ -47,7 +48,7 @@ int labcomm_scheduler_wakeup(struct labcomm_scheduler *s);
/* Deferred action handling */
int labcomm_scheduler_enqueue(struct labcomm_scheduler *s,
useconds_t delay,
uint32_t delay,
void (*deferred)(void *context),
void *context);
......
......@@ -28,7 +28,7 @@
struct labcomm_time {
const struct labcomm_time_action {
int (*free)(struct labcomm_time *t);
int (*add_usec)(struct labcomm_time *t, useconds_t usec);
int (*add_usec)(struct labcomm_time *t, uint32_t usec);
} *action;
void *context;
};
......@@ -45,7 +45,7 @@ struct labcomm_scheduler {
struct labcomm_time *wakeup);
int (*wakeup)(struct labcomm_scheduler *s);
int (*enqueue)(struct labcomm_scheduler *s,
useconds_t delay,
uint32_t delay,
void (*deferred)(void *context),
void *context);
} *action;
......
......@@ -35,7 +35,7 @@ int labcomm_time_free(struct labcomm_time *s)
TIME(free, s);
}
int labcomm_time_add_usec(struct labcomm_time *s, useconds_t usec)
int labcomm_time_add_usec(struct labcomm_time *s, uint32_t usec)
{
TIME(add_usec, s, usec);
}
......
......@@ -164,6 +164,10 @@ int main(void)
encoder_var, decoder_var);
exit(1);
}
fprintf(stderr, "Size: %d %d\n",
labcomm_sizeof_test_sample_test_var(NULL, NULL),
writer.pos);
// exit(1);
return 0;
}
......
......@@ -52,8 +52,7 @@ gen/%/c_relay.c: gen/%/typeinfo relay_gen_c.py Makefile
.PRECIOUS: gen/%/c_relay
gen/%/c_relay: gen/%/c_relay.c gen/%/c_code.c Makefile
$(CC) $(CFLAGS) -o $@ $< -I../lib/c -I. -L..//lib/c \
gen/$*/c_code.c \
-llabcomm -Tlabcomm.linkscript
gen/$*/c_code.c -llabcomm
# C# relay test rules
.PRECIOUS: gen/%/cs_code.cs
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment