Commit 3e0fb8fb56426d4645a50ce85fead9ad93ce59ba

Ramsay Jones 2009-06-04T17:12:59

thread-utils.h: Avoid using a non-standard C construct In particular, in standard C, a struct or union must have at least one member declared (ie. structs and unions cannot be empty). Some compilers allow empty structs as an extension and won't even issue a warning unless asked for it (eg, gcc requires -pedantic). Some compilers allow empty structs as an extension and will only treat it as an error if asked for strict checking (eg Digital-Mars with -A). Some compilers simply treat it as an error (eg MS Visual C/C++). Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Andreas Ericsson <ae@op5.se>

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/src/thread-utils.h b/src/thread-utils.h
index 9922841..0395b97 100644
--- a/src/thread-utils.h
+++ b/src/thread-utils.h
@@ -69,7 +69,7 @@ GIT_INLINE(int) gitrc_dec(git_refcnt *p)
 # error GIT_THREADS but no git_lck implementation
 
 #else
-typedef struct {} git_lck;
+typedef struct { int dummy; } git_lck;
 # define GIT_MUTEX_INIT   {}
 # define gitlck_init(a)   (void)0
 # define gitlck_lock(a)   (void)0