Remove some warnings about uninitilized fields with CLANG.
This commit is contained in:
1 parent
e2e902552e
commit
1efd7e84a7
2 files changed
+18
-3
No files matched your search
@@ -3353,9 +3353,12 @@ cannot use return / goto to go outside the flow).
|
||||
This macro needs either GCC (for nested function) or CLANG (for blocks) to
|
||||
work.
|
||||
|
||||
NOTE: Even if nested functions are used for GCC, it doesn't generate
|
||||
NOTE1: Even if nested functions are used for GCC, it doesn't generate
|
||||
a trampoline and the stack doesn't need to be executable.
|
||||
|
||||
NOTE2: For CLANG, you need to add -fblocks to CFLAGS and -lBlocksRuntime to LIB (See CLANG manual).
|
||||
|
||||
NOTE3: It will generate warnings about shadow variables. There is no way to avoid this.
|
||||
|
||||
### M-ALGO
|
||||
|
||||
|
||||
+14
-2
@@ -68,6 +68,18 @@ typedef struct {
|
||||
#endif
|
||||
} worker_order_t;
|
||||
|
||||
/* Define the macros needed to initialize an order.
|
||||
* * MACRO to be used to send an empty order to stop the thread
|
||||
* * MACRO to complete the not-used fields
|
||||
*/
|
||||
#if WORKER_CLANG_BLOCK
|
||||
# define WORKER_EMPTY_ORDER { NULL, NULL, NULL, NULL }
|
||||
# define WORKER_EXTRA_ORDER , NULL
|
||||
#else
|
||||
# define WORKER_EMPTY_ORDER { NULL, NULL, NULL }
|
||||
# define WORKER_EXTRA_ORDER
|
||||
#endif
|
||||
|
||||
/* This type defines a worker */
|
||||
typedef struct {
|
||||
m_thread_t id;
|
||||
@@ -171,7 +183,7 @@ static inline void
|
||||
worker_clear(worker_t g)
|
||||
{
|
||||
for(unsigned int i = 0; i < g->numWorker_g; i++) {
|
||||
worker_order_t w = { NULL, NULL, NULL};
|
||||
worker_order_t w = WORKER_EMPTY_ORDER;
|
||||
worker_queue_push (g->queue_g, w);
|
||||
}
|
||||
|
||||
@@ -197,7 +209,7 @@ worker_start(worker_block_t block)
|
||||
static inline void
|
||||
worker_spawn(worker_t g, worker_block_t block, void (*func)(void *data), void *data)
|
||||
{
|
||||
const worker_order_t w = { block, data, func };
|
||||
const worker_order_t w = { block, data, func WORKER_EXTRA_ORDER };
|
||||
if (M_UNLIKELY (!worker_queue_full_p(g->queue_g))
|
||||
&& worker_queue_push (g->queue_g, w) == true) {
|
||||
//printf ("Sending data to thread: %p (block: %d / %d)\n", data, block->num_spawn, block->num_terminated_spawn);
|
||||
|
||||
Reference in new issue
Block a user