shared/macro.h has two versions of assert_cc, one that uses gcc
_Static_assert(), which requires recent enough gcc versions, and one
that uses a fake array to trigger a build error. The latter can only
work inside functions, so assert_cc() should only be used inside
functions.
Fixes the following build failure when building kmod with old gcc
versions such as gcc 4.3.x:
shared/util.c:52: error: expected identifier or '(' before 'do'
shared/util.c:52: error: expected identifier or '(' before 'while'
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
{ }
};
-assert_cc(EAGAIN == EWOULDBLOCK);
-
/* string handling functions and memory allocations */
/* ************************************************************************ */
size_t todo = buflen - 1;
size_t done = 0;
+ assert_cc(EAGAIN == EWOULDBLOCK);
+
do {
ssize_t r = read(fd, buf + done, todo);
size_t todo = buflen;
size_t done = 0;
+ assert_cc(EAGAIN == EWOULDBLOCK);
+
do {
ssize_t r = write(fd, buf + done, todo);