Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Anders Blomdell
LabComm
Commits
41e5bb26
Commit
41e5bb26
authored
Aug 23, 2013
by
Anders Blomdell
Browse files
Various C99 compliance fixes.
parent
a5deb387
Changes
12
Hide whitespace changes
Inline
Side-by-side
compiler/C_CodeGen.jrag
View file @
41e5bb26
...
...
@@ -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);");
}
}
...
...
examples/twoway/Makefile
View file @
41e5bb26
...
...
@@ -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
:
...
...
lib/c/Makefile
View file @
41e5bb26
...
...
@@ -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
...
...
lib/c/labcomm_decoder.c
View file @
41e5bb26
...
...
@@ -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
&&
b
cmp
((
void
*
)
s
->
signature
->
signature
,
(
void
*
)
signature
.
signature
,
mem
cmp
((
void
*
)
s
->
signature
->
signature
,
(
void
*
)
signature
.
signature
,
signature
.
size
)
==
0
)
{
s
->
remote_index
=
remote_index
;
local_signature
=
s
->
signature
;
...
...
lib/c/labcomm_default_scheduler.c
View file @
41e5bb26
...
...
@@ -79,7 +79,7 @@ static int scheduler_wakeup(struct labcomm_scheduler *s)
}
static
int
scheduler_enqueue
(
struct
labcomm_scheduler
*
s
,
u
seconds
_t
delay
,
u
int32
_t
delay
,
void
(
*
deferred
)(
void
*
context
),
void
*
context
)
{
...
...
lib/c/labcomm_pthread_scheduler.c
View file @
41e5bb26
...
...
@@ -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
,
u
seconds
_t
usec
)
static
void
timespec_add_usec
(
struct
timespec
*
t
,
u
int32
_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
,
u
seconds
_t
usec
)
static
int
time_add_usec
(
struct
labcomm_time
*
t
,
u
int32
_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
,
u
seconds
_t
delay
,
u
int32
_t
delay
,
void
(
*
deferred
)(
void
*
context
),
void
*
context
)
{
...
...
lib/c/labcomm_scheduler.c
View file @
41e5bb26
...
...
@@ -75,7 +75,7 @@ int labcomm_scheduler_wakeup(struct labcomm_scheduler *s)
}
int
labcomm_scheduler_enqueue
(
struct
labcomm_scheduler
*
s
,
u
seconds
_t
delay
,
u
int32
_t
delay
,
void
(
*
func
)(
void
*
context
),
void
*
context
)
{
...
...
lib/c/labcomm_scheduler.h
View file @
41e5bb26
...
...
@@ -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
,
u
seconds
_t
usec
);
int
labcomm_time_add_usec
(
struct
labcomm_time
*
t
,
u
int32
_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
,
u
seconds
_t
delay
,
u
int32
_t
delay
,
void
(
*
deferred
)(
void
*
context
),
void
*
context
);
...
...
lib/c/labcomm_scheduler_private.h
View file @
41e5bb26
...
...
@@ -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
,
u
seconds
_t
usec
);
int
(
*
add_usec
)(
struct
labcomm_time
*
t
,
u
int32
_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
,
u
seconds
_t
delay
,
u
int32
_t
delay
,
void
(
*
deferred
)(
void
*
context
),
void
*
context
);
}
*
action
;
...
...
lib/c/labcomm_time.c
View file @
41e5bb26
...
...
@@ -35,7 +35,7 @@ int labcomm_time_free(struct labcomm_time *s)
TIME
(
free
,
s
);
}
int
labcomm_time_add_usec
(
struct
labcomm_time
*
s
,
u
seconds
_t
usec
)
int
labcomm_time_add_usec
(
struct
labcomm_time
*
s
,
u
int32
_t
usec
)
{
TIME
(
add_usec
,
s
,
usec
);
}
...
...
lib/c/test/test_labcomm.c
View file @
41e5bb26
...
...
@@ -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
;
}
...
...
test/Makefile
View file @
41e5bb26
...
...
@@ -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
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment