Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Acked-by: Eric Engestrom <eric.engestrom@intel.com>
#define _UTIL_CPU_DETECT_H
#define _UTIL_CPU_DETECT_H
-#include "pipe/p_compiler.h"
#include "pipe/p_config.h"
#include "pipe/p_config.h"
#include "pipe/p_config.h"
#include "pipe/p_config.h"
-#include "pipe/p_compiler.h"
#include "util/u_debug.h"
#include "pipe/p_format.h"
#include "pipe/p_state.h"
#include "util/u_debug.h"
#include "pipe/p_format.h"
#include "pipe/p_state.h"
debug_get_option_should_print(void)
{
debug_get_option_should_print(void)
{
- static boolean first = TRUE;
- static boolean value = FALSE;
+ static bool first = true;
+ static bool value = false;
if (!first)
return value;
if (!first)
return value;
/* Oh hey this will call into this function,
* but its cool since we set first to false
*/
/* Oh hey this will call into this function,
* but its cool since we set first to false
*/
- first = FALSE;
- value = debug_get_bool_option("GALLIUM_PRINT_OPTIONS", FALSE);
+ first = false;
+ value = debug_get_bool_option("GALLIUM_PRINT_OPTIONS", false);
/* XXX should we print this option? Currently it wont */
return value;
}
/* XXX should we print this option? Currently it wont */
return value;
}
-boolean
-debug_get_bool_option(const char *name, boolean dfault)
+bool
+debug_get_bool_option(const char *name, bool dfault)
{
const char *str = os_get_option(name);
{
const char *str = os_get_option(name);
if (str == NULL)
result = dfault;
else if (!strcmp(str, "n"))
if (str == NULL)
result = dfault;
else if (!strcmp(str, "n"))
else if (!strcmp(str, "no"))
else if (!strcmp(str, "no"))
else if (!strcmp(str, "0"))
else if (!strcmp(str, "0"))
else if (!strcmp(str, "f"))
else if (!strcmp(str, "f"))
else if (!strcmp(str, "F"))
else if (!strcmp(str, "F"))
else if (!strcmp(str, "false"))
else if (!strcmp(str, "false"))
else if (!strcmp(str, "FALSE"))
else if (!strcmp(str, "FALSE"))
if (debug_get_option_should_print())
debug_printf("%s: %s = %s\n", __FUNCTION__, name,
if (debug_get_option_should_print())
debug_printf("%s: %s = %s\n", __FUNCTION__, name,
str_has_option(const char *str, const char *name)
{
/* Empty string. */
if (!*str) {
str_has_option(const char *str, const char *name)
{
/* Empty string. */
if (!*str) {
}
/* OPTION=all */
if (!strcmp(str, "all")) {
}
/* OPTION=all */
if (!strcmp(str, "all")) {
}
/* Find 'name' in 'str' surrounded by non-alphanumeric characters. */
}
/* Find 'name' in 'str' surrounded by non-alphanumeric characters. */
if (!*str || !(isalnum(*str) || *str == '_')) {
if (str-start == name_len &&
!memcmp(start, name, name_len)) {
if (!*str || !(isalnum(*str) || *str == '_')) {
if (str-start == name_len &&
!memcmp(start, name, name_len)) {
*/
#define debug_printf_once(args) \
do { \
*/
#define debug_printf_once(args) \
do { \
- static boolean once = TRUE; \
+ static bool once = true; \
debug_printf args; \
} \
} while (0)
debug_printf args; \
} \
} while (0)
#ifdef DEBUG
#define debug_warn_once(__msg) \
do { \
#ifdef DEBUG
#define debug_warn_once(__msg) \
do { \
- static bool warned = FALSE; \
+ static bool warned = false; \
if (!warned) { \
_debug_printf("%s:%u:%s: one time warning: %s\n", \
__FILE__, __LINE__, __FUNCTION__, __msg); \
if (!warned) { \
_debug_printf("%s:%u:%s: one time warning: %s\n", \
__FILE__, __LINE__, __FUNCTION__, __msg); \
const char *
debug_get_option(const char *name, const char *dfault);
const char *
debug_get_option(const char *name, const char *dfault);
-boolean
-debug_get_bool_option(const char *name, boolean dfault);
+bool
+debug_get_bool_option(const char *name, bool dfault);
long
debug_get_num_option(const char *name, long dfault);
long
debug_get_num_option(const char *name, long dfault);
static const char * \
debug_get_option_ ## suffix (void) \
{ \
static const char * \
debug_get_option_ ## suffix (void) \
{ \
- static boolean first = TRUE; \
+ static bool first = true; \
static const char * value; \
if (first) { \
static const char * value; \
if (first) { \
value = debug_get_option(name, dfault); \
} \
return value; \
}
#define DEBUG_GET_ONCE_BOOL_OPTION(sufix, name, dfault) \
value = debug_get_option(name, dfault); \
} \
return value; \
}
#define DEBUG_GET_ONCE_BOOL_OPTION(sufix, name, dfault) \
debug_get_option_ ## sufix (void) \
{ \
debug_get_option_ ## sufix (void) \
{ \
- static boolean first = TRUE; \
- static boolean value; \
+ static bool first = true; \
+ static bool value; \
value = debug_get_bool_option(name, dfault); \
} \
return value; \
value = debug_get_bool_option(name, dfault); \
} \
return value; \
static long \
debug_get_option_ ## sufix (void) \
{ \
static long \
debug_get_option_ ## sufix (void) \
{ \
- static boolean first = TRUE; \
+ static bool first = true; \
static long value; \
if (first) { \
static long value; \
if (first) { \
value = debug_get_num_option(name, dfault); \
} \
return value; \
value = debug_get_num_option(name, dfault); \
} \
return value; \
static unsigned long \
debug_get_option_ ## sufix (void) \
{ \
static unsigned long \
debug_get_option_ ## sufix (void) \
{ \
- static boolean first = TRUE; \
+ static bool first = true; \
static unsigned long value; \
if (first) { \
static unsigned long value; \
if (first) { \
value = debug_get_flags_option(name, flags, dfault); \
} \
return value; \
value = debug_get_flags_option(name, flags, dfault); \
} \
return value; \