M_PRINT_ARG & M_FPRINT_ARG don't put a final semicolon at the end

of their expansion anymore (cleaner and no longer needed with the
new available tools).
This commit is contained in:
Patrick Pelissier committed 2018-08-01 19:59:57 +02:00
1 parent 6a70eba83f
commit 017f25d9d5
2 files changed
+11 -9

No files matched your search

+3 -1
View File
@@ -20,5 +20,7 @@ V0.2.*: * worker_start takes a 'worker_t' as an additional parameter
* Rename ALGO _contains as _contain_p
since it is a predicate '_p' and it shall be in infinitive form.
* Rename algo _map as _for_each (Standard name).
* M_PRINT_ARG & M_FPRINT_ARG don't put a final semicolon at the end
of their expansion anymore (cleaner and no longer needed with the
new available tools).
+8 -8
View File
@@ -1265,21 +1265,21 @@
const void *: "%p", \
void *: "%p")
/* Print a C variable if it is a standard type to stdout.
Note: final ';' is needed to be called within a M_MAP */
#define M_PRINT_ARG(x) printf(M_PRINTF_FORMAT(x), x);
/* Print a C variable if it is a standard type to stdout.*/
#define M_PRINT_ARG(x) printf(M_PRINTF_FORMAT(x), x)
/* Print a C variable if it is a standard type to the given file 'f'
Note: final ';' is needed to be called within a M_MAP2 */
#define M_FPRINT_ARG(f, x) fprintf(f, M_PRINTF_FORMAT(x), x);
/* Print a C variable if it is a standard type to the given file 'f'.*/
#define M_FPRINT_ARG(f, x) fprintf(f, M_PRINTF_FORMAT(x), x)
#define M_SEPARATE_PER_SEMICOLON(a,b) a ; b
/* Generic PRINT macro: print all its inputs regardless of the type
provided it is a generic "non-struct" type. */
#define M_PRINT(...) do { M_MAP(M_PRINT_ARG, __VA_ARGS__) } while (0)
#define M_PRINT(...) do { M_REDUCE(M_PRINT_ARG, M_SEPARATE_PER_SEMICOLON, __VA_ARGS__); } while (0)
/* Generic FPRINT macro: print all its inputs regardless of the type
provided it is a generic "non-struct" type into the file 'f'. */
#define M_FPRINT(f,...) do { M_MAP2(M_FPRINT_ARG, f, __VA_ARGS__) } while (0)
#define M_FPRINT(f,...) do { M_REDUCE2(M_FPRINT_ARG, M_SEPARATE_PER_SEMICOLON, f, __VA_ARGS__); } while (0)
/* Within a C11 _Generic statement, all expressions shall be valid C
expression even if the case if always false, and is not executed.