<commit_before>/* Copyright (c) 2013, Linaro Limited
 * All rights reserved.
 *
 * SPDX-License-Identifier:     BSD-3-Clause
 */
/**
 * @file
 *
 * ODP debug
 */

#ifndef ODP_DEBUG_H_
#define ODP_DEBUG_H_

#include <stdio.h>

#ifdef __cplusplus
extern "C" {
#endif

#ifdef __GNUC__

/**
 * Indicate deprecated variables, functions or types
 */
#define ODP_DEPRECATED __attribute__((__deprecated__))

/**
 * Intentionally unused variables ot functions
 */
#define ODP_UNUSED     __attribute__((__unused__))

#else

#define ODP_DEPRECATED
#define ODP_UNUSED

#endif

/**
 * Runtime assertion-macro - aborts if 'cond' is false.
 */
#ifndef ODP_NO_DEBUG
#define ODP_ASSERT(cond, msg) \
	do { if (!(cond)) {ODP_ERR("%s\n", msg); abort(); } } while (0)
#else
#define ODP_ASSERT(cond, msg)
#endif

/**
 * Compile time assertion-macro - fail compilation if cond is false.
 * @note This macro has zero runtime overhead
 */
#define ODP_STATIC_ASSERT(cond, msg)  _Static_assert(cond, msg)

/**
 * Debug printing macro, which prints output when DEBUG flag is set.
 */
#define ODP_DBG(fmt, ...) \
		do { if (ODP_DEBUG_PRINT == 1) \
			printf(fmt, ##__VA_ARGS__); \
		} while (0)

/**
 * Print output to stderr (file, line and function).
 */
#define ODP_ERR(fmt, ...) \
	fprintf(stderr, "%s:%d:%s(): " fmt, __FILE__, \
		__LINE__, __func__, ##__VA_ARGS__)

#ifdef __cplusplus
}
#endif

#endif
<commit_msg>odp_debug.h: backward compatible _Static_assert<commit_after>/* Copyright (c) 2013, Linaro Limited
 * All rights reserved.
 *
 * SPDX-License-Identifier:     BSD-3-Clause
 */
/**
 * @file
 *
 * ODP debug
 */

#ifndef ODP_DEBUG_H_
#define ODP_DEBUG_H_

#include <stdio.h>

#ifdef __cplusplus
extern "C" {
#endif

#ifdef __GNUC__

/**
 * Indicate deprecated variables, functions or types
 */
#define ODP_DEPRECATED __attribute__((__deprecated__))

/**
 * Intentionally unused variables ot functions
 */
#define ODP_UNUSED     __attribute__((__unused__))

#if __GNUC__ < 4 || (__GNUC__ == 4 && (__GNUC_MINOR__ < 6))

/**
 * _Static_assert was only added in GCC 4.6. Provide a weak replacement
 * for previous versions.
 */
#define _Static_assert(e, s) extern int (*static_assert_checker (void)) \
	[sizeof (struct { unsigned int error_if_negative: (e) ? 1 : -1; })]

#endif

#else

#define ODP_DEPRECATED
#define ODP_UNUSED

#endif

/**
 * Runtime assertion-macro - aborts if 'cond' is false.
 */
#ifndef ODP_NO_DEBUG
#define ODP_ASSERT(cond, msg) \
	do { if (!(cond)) {ODP_ERR("%s\n", msg); abort(); } } while (0)
#else
#define ODP_ASSERT(cond, msg)
#endif

/**
 * Compile time assertion-macro - fail compilation if cond is false.
 * @note This macro has zero runtime overhead
 */
#define ODP_STATIC_ASSERT(cond, msg)  _Static_assert(cond, msg)

/**
 * Debug printing macro, which prints output when DEBUG flag is set.
 */
#define ODP_DBG(fmt, ...) \
		do { if (ODP_DEBUG_PRINT == 1) \
			printf(fmt, ##__VA_ARGS__); \
		} while (0)

/**
 * Print output to stderr (file, line and function).
 */
#define ODP_ERR(fmt, ...) \
	fprintf(stderr, "%s:%d:%s(): " fmt, __FILE__, \
		__LINE__, __func__, ##__VA_ARGS__)

#ifdef __cplusplus
}
#endif

#endif

{'fraction_non_alphanumeric': 0.14577352472089314, 'fraction_numerical': 0.00733652312599681, 'mean_word_length': 3.915360501567398, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '724513', 'n_tokens_mistral': 1172, 'n_tokens_neox': 1134, 'n_words': 316}