Loading...
Searching...
No Matches
stmt.h
Go to the documentation of this file.
#ifndef ML99_STMT_H
#define ML99_STMT_H
#include <metalang99/util.h>
#define ML99_INTRODUCE_VAR_TO_STMT(...) ML99_PRIV_INTRODUCE_VAR_TO_STMT_INNER(__VA_ARGS__)
#define ML99_INTRODUCE_NON_NULL_PTR_TO_STMT(ty, name, init) \
ML99_PRIV_SHADOWS(for (ty *name = (init); name != 0; name = 0))
#define ML99_CHAIN_EXPR_STMT(expr) \
ML99_PRIV_SHADOWS(for (int ml99_priv_expr_stmt_break = ((expr), 0); \
ml99_priv_expr_stmt_break != 1; \
ml99_priv_expr_stmt_break = 1))
#define ML99_CHAIN_EXPR_STMT_AFTER(expr) \
ML99_PRIV_SHADOWS(for (int ml99_priv_expr_stmt_after_break = 0; \
ml99_priv_expr_stmt_after_break != 1; \
((expr), ml99_priv_expr_stmt_after_break = 1)))
#define ML99_SUPPRESS_UNUSED_BEFORE_STMT(expr) ML99_CHAIN_EXPR_STMT((void)expr)
#ifndef DOXYGEN_IGNORE
// See <https://github.com/hirrolot/metalang99/issues/25>.
#ifdef __cplusplus
#define ML99_PRIV_INTRODUCE_VAR_TO_STMT_INNER(...) \
ML99_PRIV_SHADOWS(for (__VA_ARGS__, \
*ml99_priv_break_arr[] = {0, 0}, \
**ml99_priv_break = &ml99_priv_break_arr[0]; \
ml99_priv_break == &ml99_priv_break_arr[0]; \
ml99_priv_break++))
#else
#define ML99_PRIV_INTRODUCE_VAR_TO_STMT_INNER(...) \
ML99_PRIV_SHADOWS(for (__VA_ARGS__, *ml99_priv_break = (void *)0; \
ml99_priv_break != (void *)1; \
ml99_priv_break = (void *)1))
#endif
#define ML99_PRIV_SHADOWS(...) \
ML99_CLANG_PRAGMA("clang diagnostic push") \
ML99_CLANG_PRAGMA("clang diagnostic ignored \"-Wshadow\"") \
__VA_ARGS__ \
ML99_CLANG_PRAGMA("clang diagnostic pop")
#endif // DOXYGEN_IGNORE
#endif // ML99_STMT_H
util.h
Utilitary stuff.