**************************************************************************/
#include <stdio.h>
+#include <inttypes.h>
#include "util/u_debug.h"
#include "util/u_memory.h"
type_fmt[4] = 'g';
type_fmt[5] = '\0';
} else if (type_kind == LLVMIntegerTypeKind) {
- if (LLVMGetIntTypeWidth(type_ref) == 8) {
+ if (LLVMGetIntTypeWidth(type_ref) == 64) {
+ snprintf(type_fmt + 2, 3, "%s", PRId64);
+ } else if (LLVMGetIntTypeWidth(type_ref) == 8) {
type_fmt[2] = 'u';
} else {
type_fmt[2] = 'i';
}
+ } else if (type_kind == LLVMPointerTypeKind) {
+ type_fmt[2] = 'p';
} else {
/* Unsupported type */
assert(0);
params[1] = lp_build_const_string(gallivm, msg);
if (length == 1) {
- util_strncat(format, type_fmt, sizeof(format) - strlen(format) - 1);
+ strncat(format, type_fmt, sizeof(format) - strlen(format) - 1);
params[2] = value;
} else {
for (i = 0; i < length; ++i) {
LLVMValueRef param;
- util_strncat(format, type_fmt, sizeof(format) - strlen(format) - 1);
+ strncat(format, type_fmt, sizeof(format) - strlen(format) - 1);
param = LLVMBuildExtractElement(builder, value, lp_build_const_int32(gallivm, i), "");
if (type_kind == LLVMIntegerTypeKind &&
LLVMGetIntTypeWidth(type_ref) < sizeof(int) * 8) {
}
}
- util_strncat(format, "\n", sizeof(format) - strlen(format) - 1);
+ strncat(format, "\n", sizeof(format) - strlen(format) - 1);
params[0] = lp_build_const_string(gallivm, format);
return lp_build_print_args(gallivm, 2 + length, params);
}
-static int
+static unsigned
lp_get_printf_arg_count(const char *fmt)
{
- int count =0;
+ unsigned count = 0;
const char *p = fmt;
int c;
{
LLVMValueRef params[50];
va_list arglist;
- int argcount;
- int i;
+ unsigned argcount, i;
argcount = lp_get_printf_arg_count(fmt);
- assert(Elements(params) >= argcount + 1);
+ assert(ARRAY_SIZE(params) >= argcount + 1);
va_start(arglist, fmt);
for (i = 1; i <= argcount; i++) {