Commit Graph

4 Commits

Author SHA1 Message Date
Felipe Oliveira Carvalho
967fb1aca6 Reimplement the event queue in event.c using klist.h
- Add a new macro to klist.h: kl_empty()

   The whole point of abstract data structures is to avoid reimplementing
   common actions. The emptiness test seems to be such an action.

 - Add a new function attribute to func_attr.h: FUNC_ATTR_UNUSED

   Some of the many functions created by the macros in klist.h may end up not
   being used. Unused functions cause compilation errors as we compile with
   -Werror. To mark those functions as possibly unused we can use the
   FUNC_ATTR_UNUSED now.

 - Pass `Event` by value

   `Event` is such a small struct that I don't think we should allocate heap space
   and pass it by reference. Let's use the stack and memory cache in our favor
   passing it by value.
2014-04-07 00:22:01 -03:00
Nicolas Hillegeer
22e17e25f1 func-attr: add some extra handy function attrs
The attributes in question are:

- nonnull: specify whether a function argument cannot/may not be null
- returns_nonnull: specify whether a function will not return a null
  pointer (example: xmalloc can't return null, so it should be annotated as
  such). Only available from gcc 4.9 onwards.

Currently these attributes are only supported by gcc.
2014-03-31 18:42:17 -03:00
Nicolas Hillegeer
f5db0d01ba func-attr: clang 3.5 doesn't support alloc_size
The attribute was removed in commit c047507 in the clang repository as it
was never properly implemented anyway. This fixes compiling with clang 3.5.

Fixes issue #429
2014-03-31 18:42:17 -03:00
Nicolas Hillegeer
d5708b200a add func_attr.h to be able to use func attribs
Currently enables these for every gnu-like compilers, i.e.: gcc, clang and
icc.
2014-03-29 20:09:57 +01:00