size_t Format specifiers in c?

本文探讨了在C语言中如何正确打印size_t类型的变量。由于size_t在不同架构下可能被别名为不同的类型,因此使用通用的打印格式可能会导致警告。文章提供了平台无关的解决方案,介绍了使用%zd和%zu格式化字符串来正确输出size_t变量。


I want to print out a variable of type size_t in C but it appears that size_t is aliased to different variable types on different architectures. For example, on one machine (64-bit) the following code does not throw any warnings:

size_t size = 1;
printf("the size is %ld", size);

but on my other machine (32-bit) the above code produces the following warning message:

warning: format '%ld' expects type 'long int *', but argument 3 has type 'size_t *'

I suspect this is due to the difference in pointer size, so that on my 64-bit machine size_t is aliased to a long int ("%ld"), whereas on my 32-bit machine size_t is aliased to another type.

Is there a format specifier specifically for size_t?

share improve this question
 
 
Your warning message does not match the code. The warning mentions pointers, your code doesn't have any. Did you remove some & somewhere? –  Jens  Apr 17 '12 at 14:38
 
Pointers? No I don't get any warnings about pointers, in fact depending on what machine I run that code on sometimes I get no warnings at all. Try the following test code: #include <stdio.h> int main(){ size_t size = 1; printf("the size is %ld", size); return 0; } –  Ethan Heilman  Apr 17 '12 at 16:39
1 
 
@EthanHeilman He's referring to the fact that your warnings say warning: format '%ld' expects type 'long int *', but argument 3 has type 'size_t *' when it probably should be saying warning: format '%ld' expects type 'long int', but argument 3 has type 'size_t'. Were you maybe using scanf() instead when you got these warnings? –  RastaJedi  Aug 20 at 19:04

3 Answers

up vote 70 down vote accepted

Yes: use the z length modifier:

size_t size = sizeof(char);
printf("the size is %zd\n", size);  // decimal size_t
printf("the size is %zx\n", size);  // hex size_t

The other length modifiers that are available are hh (for char), h (for short), l (for long), ll(for long long), j (for intmax_t), t (for ptrdiff_t), and L (for long double). See §7.19.6.1 (7) of the C99 standard.

share improve this answer
 
 
whats the difference between zd and zu? I get that zd is decimal, but is it signed, if so how does zd being signed effect things. –  Ethan Heilman  Jan 24 '10 at 3:51
1 
It's the difference between a size_t and an ssize_t; the latter is seldomly used. –  Adam Rosenfield  Jan 24 '10 at 3:53
16 
Right, so in this case, you should be using %zu, because the argument is unsigned. –  caf  Jan 24 '10 at 23:03
 
The other options available are explained in the printf manual page: linux.die.net/man/3/printf –  INS  Jan 7 '14 at 22:00
2 
@detly: No, the z length modifier is not part of C89/C90. If you're aiming for C89-compliant code, the best you can do is cast to unsigned long and use the l length modifier instead, e.g. printf("the size is %lu\n", (unsigned long)size);; supporting both C89 and systems with size_t larger than long is trickier and would require using a number of preprocessor macros. –  Adam Rosenfield  Mar 25 '14 at 6:01

Yes, there is. It is %zu (as specified in ANSI C99).

size_t size = 1;
printf("the size is %zu", size);

Note that size_t is unsigned, thus %ld is double wrong: wrong length modifier and wrong format conversion specifier. In case you wonder, %zd is for ssize_t (which is signed).

share improve this answer
 

MSDN, says that Visual Studio supports the "I" prefix for code portable on 32 and 64 bit platforms.

size_t size = 10;
printf("size is %Iu", size);
share improve this answer
 
1 
it's MS specific, which is not standard conforming, so it's not platform independent –  Lưu Vĩnh Phúc  Jun 24 at 7:24

I want to print out a variable of type size_t in C but it appears that size_t is aliased to different variable types on different architectures. For example, on one machine (64-bit) the following code does not throw any warnings:

size_t size = 1;
printf("the size is %ld", size);

but on my other machine (32-bit) the above code produces the following warning message:

warning: format '%ld' expects type 'long int *', but argument 3 has type 'size_t *'

I suspect this is due to the difference in pointer size, so that on my 64-bit machine size_t is aliased to a long int ("%ld"), whereas on my 32-bit machine size_t is aliased to another type.

Is there a format specifier specifically for size_t?

share improve this question
 
   
Your warning message does not match the code. The warning mentions pointers, your code doesn't have any. Did you remove some & somewhere? –  Jens  Apr 17 '12 at 14:38
   
Pointers? No I don't get any warnings about pointers, in fact depending on what machine I run that code on sometimes I get no warnings at all. Try the following test code: #include <stdio.h> int main(){ size_t size = 1; printf("the size is %ld", size); return 0; } –  Ethan Heilman  Apr 17 '12 at 16:39
1 
   
@EthanHeilman He's referring to the fact that your warnings say warning: format '%ld' expects type 'long int *', but argument 3 has type 'size_t *' when it probably should be saying warning: format '%ld' expects type 'long int', but argument 3 has type 'size_t'. Were you maybe using scanf() instead when you got these warnings? –  RastaJedi  Aug 20 at 19:04

3 Answers

up vote 70 down vote accepted

Yes: use the z length modifier:

size_t size = sizeof(char);
printf("the size is %zd\n", size);  // decimal size_t
printf("the size is %zx\n", size);  // hex size_t

The other length modifiers that are available are hh (for char), h (for short), l (for long), ll(for long long), j (for intmax_t), t (for ptrdiff_t), and L (for long double). See §7.19.6.1 (7) of the C99 standard.

share improve this answer
 
   
whats the difference between zd and zu? I get that zd is decimal, but is it signed, if so how does zd being signed effect things. –  Ethan Heilman  Jan 24 '10 at 3:51
1 
It's the difference between a size_t and an ssize_t; the latter is seldomly used. –  Adam Rosenfield  Jan 24 '10 at 3:53
16 
Right, so in this case, you should be using %zu, because the argument is unsigned. –  caf  Jan 24 '10 at 23:03
   
The other options available are explained in the printf manual page: linux.die.net/man/3/printf –  INS  Jan 7 '14 at 22:00
2 
@detly: No, the z length modifier is not part of C89/C90. If you're aiming for C89-compliant code, the best you can do is cast to unsigned long and use the l length modifier instead, e.g. printf("the size is %lu\n", (unsigned long)size);; supporting both C89 and systems with size_t larger than long is trickier and would require using a number of preprocessor macros. –  Adam Rosenfield  Mar 25 '14 at 6:01

Yes, there is. It is %zu (as specified in ANSI C99).

size_t size = 1;
printf("the size is %zu", size);

Note that size_t is unsigned, thus %ld is double wrong: wrong length modifier and wrong format conversion specifier. In case you wonder, %zd is for ssize_t (which is signed).

share improve this answer
 

MSDN, says that Visual Studio supports the "I" prefix for code portable on 32 and 64 bit platforms.

size_t size = 10;
printf("size is %Iu", size);
share improve this answer
 
1 
it's MS specific, which is not standard conforming, so it's not platform independent –  Lưu Vĩnh Phúc  Jun 24 at 7:24
include/jemalloc/internal/log.h:42:1: 警告:空声明 [默认启用] struct log_var_s { ^ include/jemalloc/internal/log.h:62:31: 错误:expected declaration specifiers or ‘...’ before ‘log_var_t’ unsigned log_var_update_state(log_var_t *log_var); ^ include/jemalloc/internal/log.h:89:41: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token log_impl_varargs(const char *name, ...) { ^ In file included from src/jemalloc.c:18:0: include/jemalloc/internal/spin.h:8:3: 错误:为形参‘spin_t’指定了存储类 } spin_t; ^ include/jemalloc/internal/spin.h:11:21: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token spin_cpu_spinwait() { ^ include/jemalloc/internal/spin.h:21:15: 错误:expected declaration specifiers or ‘...’ before ‘spin_t’ spin_adaptive(spin_t *spin) { ^ src/jemalloc.c:29:5: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘JEMALLOC_ATTR’ JEMALLOC_ATTR(weak) ^ src/jemalloc.c:32:1: 错误:形参‘opt_abort’已初始化 bool opt_abort = ^ src/jemalloc.c:32:6: 错误:形参‘opt_abort’重定义 bool opt_abort = ^ In file included from include/jemalloc/internal/tsd.h:7:0, from include/jemalloc/internal/mutex.h:6, from include/jemalloc/internal/extent_structs.h:7, from include/jemalloc/internal/jemalloc_internal_includes.h:54, from src/jemalloc.c:3: include/jemalloc/internal/jemalloc_internal_externs.h:11:13: 附注:‘opt_abort’的上一个定义在此 extern bool opt_abort; ^ src/jemalloc.c:39:1: 错误:形参‘opt_abort_conf’已初始化 bool opt_abort_conf = ^ src/jemalloc.c:39:6: 错误:形参‘opt_abort_conf’重定义 bool opt_abort_conf = ^ In file included from include/jemalloc/internal/tsd.h:7:0, from include/jemalloc/internal/mutex.h:6, from include/jemalloc/internal/extent_structs.h:7, from include/jemalloc/internal/jemalloc_internal_includes.h:54, from src/jemalloc.c:3: include/jemalloc/internal/jemalloc_internal_externs.h:12:13: 附注:‘opt_abort_conf’的上一个定义在此 extern bool opt_abort_conf; ^ src/jemalloc.c:47:1: 错误:形参‘opt_confirm_conf’已初始化 bool opt_confirm_conf = false; ^ src/jemalloc.c:47:6: 错误:形参‘opt_confirm_conf’重定义 bool opt_confirm_conf = false; ^ In file included from include/jemalloc/internal/tsd.h:7:0, from include/jemalloc/internal/mutex.h:6, from include/jemalloc/internal/extent_structs.h:7, from include/jemalloc/internal/jemalloc_internal_includes.h:54, from src/jemalloc.c:3: include/jemalloc/internal/jemalloc_internal_externs.h:13:13: 附注:‘opt_confirm_conf’的上一个定义在此 extern bool opt_confirm_conf; ^ src/jemalloc.c:48:1: 错误:形参‘opt_junk’已初始化 const char *opt_junk = ^ src/jemalloc.c:48:13: 错误:形参‘opt_junk’重定义 const char *opt_junk = ^ In file included from include/jemalloc/internal/tsd.h:7:0, from include/jemalloc/internal/mutex.h:6, from include/jemalloc/internal/extent_structs.h:7, from include/jemalloc/internal/jemalloc_internal_includes.h:54, from src/jemalloc.c:3: include/jemalloc/internal/jemalloc_internal_externs.h:14:20: 附注:‘opt_junk’的上一个定义在此 extern const char *opt_junk; ^ src/jemalloc.c:55:1: 错误:形参‘opt_junk_alloc’已初始化 bool opt_junk_alloc = ^ src/jemalloc.c:55:6: 错误:形参‘opt_junk_alloc’重定义 bool opt_junk_alloc = ^ In file included from include/jemalloc/internal/tsd.h:7:0, from include/jemalloc/internal/mutex.h:6, from include/jemalloc/internal/extent_structs.h:7, from include/jemalloc/internal/jemalloc_internal_includes.h:54, from src/jemalloc.c:3: include/jemalloc/internal/jemalloc_internal_externs.h:15:13: 附注:‘opt_junk_alloc’的上一个定义在此 extern bool opt_junk_alloc; ^ src/jemalloc.c:62:1: 错误:形参‘opt_junk_free’已初始化 bool opt_junk_free = ^ src/jemalloc.c:62:6: 错误:形参‘opt_junk_free’重定义 bool opt_junk_free = ^ In file included from include/jemalloc/internal/tsd.h:7:0, from include/jemalloc/internal/mutex.h:6, from include/jemalloc/internal/extent_structs.h:7, from include/jemalloc/internal/jemalloc_internal_includes.h:54, from src/jemalloc.c:3: include/jemalloc/internal/jemalloc_internal_externs.h:16:13: 附注:‘opt_junk_free’的上一个定义在此 extern bool opt_junk_free; ^ src/jemalloc.c:70:1: 错误:形参‘opt_utrace’已初始化 bool opt_utrace = false; ^ src/jemalloc.c:70:6: 错误:形参‘opt_utrace’重定义 bool opt_utrace = false; ^ In file included from include/jemalloc/internal/tsd.h:7:0, from include/jemalloc/internal/mutex.h:6, from include/jemalloc/internal/extent_structs.h:7, from include/jemalloc/internal/jemalloc_internal_includes.h:54, from src/jemalloc.c:3: include/jemalloc/internal/jemalloc_internal_externs.h:17:13: 附注:‘opt_utrace’的上一个定义在此 extern bool opt_utrace; ^ src/jemalloc.c:71:1: 错误:形参‘opt_xmalloc’已初始化 bool opt_xmalloc = false; ^ src/jemalloc.c:71:6: 错误:形参‘opt_xmalloc’重定义 bool opt_xmalloc = false; ^ In file included from include/jemalloc/internal/tsd.h:7:0, from include/jemalloc/internal/mutex.h:6, from include/jemalloc/internal/extent_structs.h:7, from include/jemalloc/internal/jemalloc_internal_includes.h:54, from src/jemalloc.c:3: include/jemalloc/internal/jemalloc_internal_externs.h:18:13: 附注:‘opt_xmalloc’的上一个定义在此 extern bool opt_xmalloc; ^ src/jemalloc.c:72:1: 错误:形参‘opt_zero’已初始化 bool opt_zero = false; ^ src/jemalloc.c:72:6: 错误:形参‘opt_zero’重定义 bool opt_zero = false; ^ In file included from include/jemalloc/internal/tsd.h:7:0, from include/jemalloc/internal/mutex.h:6, from include/jemalloc/internal/extent_structs.h:7, from include/jemalloc/internal/jemalloc_internal_includes.h:54, from src/jemalloc.c:3: include/jemalloc/internal/jemalloc_internal_externs.h:19:13: 附注:‘opt_zero’的上一个定义在此 extern bool opt_zero; ^ src/jemalloc.c:73:1: 错误:形参‘opt_narenas’已初始化 unsigned opt_narenas = 0; ^ src/jemalloc.c:73:10: 错误:形参‘opt_narenas’重定义 unsigned opt_narenas = 0; ^ In file included from include/jemalloc/internal/tsd.h:7:0, from include/jemalloc/internal/mutex.h:6, from include/jemalloc/internal/extent_structs.h:7, from include/jemalloc/internal/jemalloc_internal_includes.h:54, from src/jemalloc.c:3: include/jemalloc/internal/jemalloc_internal_externs.h:20:17: 附注:‘opt_narenas’的上一个定义在此 extern unsigned opt_narenas; ^ src/jemalloc.c:75:10: 错误:形参‘ncpus’重定义 unsigned ncpus; ^ In file included from include/jemalloc/internal/tsd.h:7:0, from include/jemalloc/internal/mutex.h:6, from include/jemalloc/internal/extent_structs.h:7, from include/jemalloc/internal/jemalloc_internal_includes.h:54, from src/jemalloc.c:3: include/jemalloc/internal/jemalloc_internal_externs.h:23:17: 附注:‘ncpus’的上一个定义在此 extern unsigned ncpus; ^ src/jemalloc.c:78:1: 错误:expected declaration specifiers before ‘malloc_mutex_t’ malloc_mutex_t arenas_lock; ^ src/jemalloc.c:89:1: 错误:expected declaration specifiers before ‘JEMALLOC_ALIGNED’ JEMALLOC_ALIGNED(CACHELINE) ^ src/jemalloc.c:91:19: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘narenas_total’ static atomic_u_t narenas_total; /* Use narenas_total_*(). */ ^ src/jemalloc.c:93:18: 错误:为形参‘a0’指定了存储类 static arena_t *a0; /* arenas[0]. */ ^ src/jemalloc.c:94:11: 错误:形参‘narenas_auto’重定义 unsigned narenas_auto; ^ In file included from include/jemalloc/internal/tsd.h:7:0, from include/jemalloc/internal/mutex.h:6, from include/jemalloc/internal/extent_structs.h:7, from include/jemalloc/internal/jemalloc_internal_includes.h:54, from src/jemalloc.c:3: include/jemalloc/internal/jemalloc_internal_externs.h:26:17: 附注:‘narenas_auto’的上一个定义在此 extern unsigned narenas_auto; ^ src/jemalloc.c:95:11: 错误:形参‘manual_arena_base’重定义 unsigned manual_arena_base; ^ In file included from include/jemalloc/internal/tsd.h:7:0, from include/jemalloc/internal/mutex.h:6, from include/jemalloc/internal/extent_structs.h:7, from include/jemalloc/internal/jemalloc_internal_includes.h:54, from src/jemalloc.c:3: include/jemalloc/internal/jemalloc_internal_externs.h:29:17: 附注:‘manual_arena_base’的上一个定义在此 extern unsigned manual_arena_base; ^ src/jemalloc.c:102:3: 错误:为形参‘malloc_init_t’指定了存储类 } malloc_init_t; ^ src/jemalloc.c:103:22: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘malloc_init_state’ static malloc_init_t malloc_init_state = malloc_init_uninitialized; ^ src/jemalloc.c:106:1: 错误:形参‘malloc_slow’已初始化 bool malloc_slow = true; ^ src/jemalloc.c:106:8: 错误:形参‘malloc_slow’重定义 bool malloc_slow = true; ^ In file included from include/jemalloc/internal/tsd.h:7:0, from include/jemalloc/internal/mutex.h:6, from include/jemalloc/internal/extent_structs.h:7, from include/jemalloc/internal/jemalloc_internal_includes.h:54, from src/jemalloc.c:3: include/jemalloc/internal/jemalloc_internal_externs.h:8:13: 附注:‘malloc_slow’的上一个定义在此 extern bool malloc_slow; ^ src/jemalloc.c:109:1: 警告:空声明 [默认启用] enum { ^ src/jemalloc.c:116:16: 错误:为形参‘malloc_slow_flags’指定了存储类 static uint8_t malloc_slow_flags; ^ src/jemalloc.c:123:19: 错误:为形参‘malloc_initializer’指定了存储类 static pthread_t malloc_initializer = NO_INITIALIZER; ^ src/jemalloc.c:123:1: 错误:形参‘malloc_initializer’已初始化 static pthread_t malloc_initializer = NO_INITIALIZER; ^ src/jemalloc.c:166:23: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘init_lock’ static malloc_mutex_t init_lock = MALLOC_MUTEX_INITIALIZER; ^ src/jemalloc.c:166:59: 错误:expected declaration specifiers before ‘;’ token static malloc_mutex_t init_lock = MALLOC_MUTEX_INITIALIZER; ^ src/jemalloc.c:173:3: 错误:为形参‘malloc_utrace_t’指定了存储类 } malloc_utrace_t; ^ src/jemalloc.c:192:13: 错误:为形参‘had_conf_error’指定了存储类 static bool had_conf_error = false; ^ src/jemalloc.c:192:1: 错误:形参‘had_conf_error’已初始化 static bool had_conf_error = false; ^ src/jemalloc.c:200:13: 错误:为形参‘malloc_init_hard_a0’指定了存储类 static bool malloc_init_hard_a0(void); ^ src/jemalloc.c:201:13: 错误:为形参‘malloc_init_hard’指定了存储类 static bool malloc_init_hard(void); ^ src/jemalloc.c:209:26: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token malloc_initialized(void) { ^ In file included from include/jemalloc/internal/jemalloc_preamble.h:34:0, from src/jemalloc.c:2: include/jemalloc/internal/jemalloc_internal_macros.h:7:34: 错误:expected declaration specifiers before ‘JEMALLOC_ATTR’ # define JEMALLOC_ALWAYS_INLINE JEMALLOC_ATTR(always_inline) static inline ^ src/jemalloc.c:213:1: 附注:in expansion of macro ‘JEMALLOC_ALWAYS_INLINE’ JEMALLOC_ALWAYS_INLINE bool ^ include/jemalloc/internal/jemalloc_internal_macros.h:7:34: 错误:expected declaration specifiers before ‘JEMALLOC_ATTR’ # define JEMALLOC_ALWAYS_INLINE JEMALLOC_ATTR(always_inline) static inline ^ src/jemalloc.c:221:1: 附注:in expansion of macro ‘JEMALLOC_ALWAYS_INLINE’ JEMALLOC_ALWAYS_INLINE bool ^ src/jemalloc.c:235:52: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token a0ialloc(size_t size, bool zero, bool is_internal) { ^ src/jemalloc.c:245:40: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token a0idalloc(void *ptr, bool is_internal) { ^ src/jemalloc.c:250:23: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token a0malloc(size_t size) { ^ src/jemalloc.c:255:21: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token a0dalloc(void *ptr) { ^ src/jemalloc.c:266:31: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token bootstrap_malloc(size_t size) { ^ src/jemalloc.c:275:43: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token bootstrap_calloc(size_t num, size_t size) { ^ src/jemalloc.c:288:27: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token bootstrap_free(void *ptr) { ^ src/jemalloc.c:297:41: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token arena_set(unsigned ind, arena_t *arena) { ^ src/jemalloc.c:302:37: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token narenas_total_set(unsigned narenas) { ^ src/jemalloc.c:307:25: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token narenas_total_inc(void) { ^ src/jemalloc.c:312:25: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token narenas_total_get(void) { ^ src/jemalloc.c:318:19: 错误:expected declaration specifiers or ‘...’ before ‘tsdn_t’ arena_init_locked(tsdn_t *tsdn, unsigned ind, extent_hooks_t *extent_hooks) { ^ src/jemalloc.c:318:47: 错误:未知的类型名‘extent_hooks_t’ arena_init_locked(tsdn_t *tsdn, unsigned ind, extent_hooks_t *extent_hooks) { ^ src/jemalloc.c:346:36: 错误:expected declaration specifiers or ‘...’ before ‘tsdn_t’ arena_new_create_background_thread(tsdn_t *tsdn, unsigned ind) { ^ src/jemalloc.c:364:12: 错误:expected declaration specifiers or ‘...’ before ‘tsdn_t’ arena_init(tsdn_t *tsdn, unsigned ind, extent_hooks_t *extent_hooks) { ^ src/jemalloc.c:364:40: 错误:未知的类型名‘extent_hooks_t’ arena_init(tsdn_t *tsdn, unsigned ind, extent_hooks_t *extent_hooks) { ^ src/jemalloc.c:377:12: 错误:expected declaration specifiers or ‘...’ before ‘tsd_t’ arena_bind(tsd_t *tsd, unsigned ind, bool internal) { ^ src/jemalloc.c:397:15: 错误:expected declaration specifiers or ‘...’ before ‘tsd_t’ arena_migrate(tsd_t *tsd, unsigned oldind, unsigned newind) { ^ src/jemalloc.c:408:14: 错误:expected declaration specifiers or ‘...’ before ‘tsd_t’ arena_unbind(tsd_t *tsd, unsigned ind, bool internal) { ^ src/jemalloc.c:422:22: 错误:expected declaration specifiers or ‘...’ before ‘tsd_t’ arena_tdata_get_hard(tsd_t *tsd, unsigned ind) { ^ src/jemalloc.c:499:19: 错误:expected declaration specifiers or ‘...’ before ‘tsd_t’ arena_choose_hard(tsd_t *tsd, bool internal) { ^ src/jemalloc.c:613:16: 错误:expected declaration specifiers or ‘...’ before ‘tsd_t’ iarena_cleanup(tsd_t *tsd) { ^ src/jemalloc.c:623:15: 错误:expected declaration specifiers or ‘...’ before ‘tsd_t’ arena_cleanup(tsd_t *tsd) { ^ src/jemalloc.c:633:22: 错误:expected declaration specifiers or ‘...’ before ‘tsd_t’ arenas_tdata_cleanup(tsd_t *tsd) { ^ src/jemalloc.c:647:26: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token stats_print_atexit(void) { ^ In file included from include/jemalloc/internal/jemalloc_preamble.h:34:0, from src/jemalloc.c:2: include/jemalloc/internal/jemalloc_internal_macros.h:7:34: 错误:expected declaration specifiers before ‘JEMALLOC_ATTR’ # define JEMALLOC_ALWAYS_INLINE JEMALLOC_ATTR(always_inline) static inline ^ src/jemalloc.c:683:1: 附注:in expansion of macro ‘JEMALLOC_ALWAYS_INLINE’ JEMALLOC_ALWAYS_INLINE void ^ src/jemalloc.c:712:42: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token jemalloc_secure_getenv(const char *name) { ^ src/jemalloc.c:726:20: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token malloc_ncpus(void) { ^ src/jemalloc.c:754:55: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token init_opt_stats_print_opts(const char *v, size_t vlen) { ^ src/jemalloc.c:781:80: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token size_t *vlen_left, size_t *slab_start, size_t *slab_end, size_t *new_size) { ^ src/jemalloc.c:824:39: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token char const **v_p, size_t *vlen_p) { ^ src/jemalloc.c:898:33: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token malloc_abort_invalid_conf(void) { ^ src/jemalloc.c:907:18: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token size_t vlen) { ^ src/jemalloc.c:920:29: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token malloc_slow_flag_init(void) { ^ src/jemalloc.c:938:67: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token obtain_malloc_conf(unsigned which_source, char buf[PATH_MAX + 1]) { ^ src/jemalloc.c:1023:29: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token char buf[PATH_MAX + 1]) { ^ src/jemalloc.c:1440:74: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token malloc_conf_init(sc_data_t *sc_data, unsigned bin_shard_sizes[SC_NBINS]) { ^ src/jemalloc.c:1453:31: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token malloc_init_hard_needed(void) { ^ src/jemalloc.c:1479:30: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token malloc_init_hard_a0_locked() { ^ src/jemalloc.c:1564:27: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token malloc_init_hard_a0(void) { ^ src/jemalloc.c:1575:35: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token malloc_init_hard_recursible(void) { ^ src/jemalloc.c:1602:30: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token malloc_narenas_default(void) { ^ src/jemalloc.c:1616:55: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token percpu_arena_as_initialized(percpu_arena_mode_t mode) { ^ src/jemalloc.c:1628:27: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token malloc_init_narenas(void) { ^ src/jemalloc.c:1704:26: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token malloc_init_percpu(void) { ^ src/jemalloc.c:1709:31: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token malloc_init_hard_finish(void) { ^ src/jemalloc.c:1721:26: 错误:expected declaration specifiers or ‘...’ before ‘tsdn_t’ malloc_init_hard_cleanup(tsdn_t *tsdn, bool reentrancy_set) { ^ src/jemalloc.c:1733:24: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token malloc_init_hard(void) { ^ src/jemalloc.c:1815:30: 错误:为形参‘static_opts_t’指定了存储类 typedef struct static_opts_s static_opts_t; ^ src/jemalloc.c:1816:1: 警告:空声明 [默认启用] struct static_opts_s { ^ In file included from include/jemalloc/internal/jemalloc_preamble.h:34:0, from src/jemalloc.c:2: include/jemalloc/internal/jemalloc_internal_macros.h:7:34: 错误:expected declaration specifiers before ‘JEMALLOC_ATTR’ # define JEMALLOC_ALWAYS_INLINE JEMALLOC_ATTR(always_inline) static inline ^ src/jemalloc.c:1863:1: 附注:in expansion of macro ‘JEMALLOC_ALWAYS_INLINE’ JEMALLOC_ALWAYS_INLINE void ^ src/jemalloc.c:1886:31: 错误:为形参‘dynamic_opts_t’指定了存储类 typedef struct dynamic_opts_s dynamic_opts_t; ^ src/jemalloc.c:1887:1: 警告:空声明 [默认启用] struct dynamic_opts_s { ^ In file included from include/jemalloc/internal/jemalloc_preamble.h:34:0, from src/jemalloc.c:2: include/jemalloc/internal/jemalloc_internal_macros.h:7:34: 错误:expected declaration specifiers before ‘JEMALLOC_ATTR’ # define JEMALLOC_ALWAYS_INLINE JEMALLOC_ATTR(always_inline) static inline ^ src/jemalloc.c:1898:1: 附注:in expansion of macro ‘JEMALLOC_ALWAYS_INLINE’ JEMALLOC_ALWAYS_INLINE void ^ include/jemalloc/internal/jemalloc_internal_macros.h:7:34: 错误:expected declaration specifiers before ‘JEMALLOC_ATTR’ # define JEMALLOC_ALWAYS_INLINE JEMALLOC_ATTR(always_inline) static inline ^ src/jemalloc.c:1911:1: 附注:in expansion of macro ‘JEMALLOC_ALWAYS_INLINE’ JEMALLOC_ALWAYS_INLINE void * ^ include/jemalloc/internal/jemalloc_internal_macros.h:7:34: 错误:expected declaration specifiers before ‘JEMALLOC_ATTR’ # define JEMALLOC_ALWAYS_INLINE JEMALLOC_ATTR(always_inline) static inline ^ src/jemalloc.c:1953:1: 附注:in expansion of macro ‘JEMALLOC_ALWAYS_INLINE’ JEMALLOC_ALWAYS_INLINE void * ^ include/jemalloc/internal/jemalloc_internal_macros.h:7:34: 错误:expected declaration specifiers before ‘JEMALLOC_ATTR’ # define JEMALLOC_ALWAYS_INLINE JEMALLOC_ATTR(always_inline) static inline ^ src/jemalloc.c:1989:1: 附注:in expansion of macro ‘JEMALLOC_ALWAYS_INLINE’ JEMALLOC_ALWAYS_INLINE bool ^ include/jemalloc/internal/jemalloc_internal_macros.h:7:34: 错误:expected declaration specifiers before ‘JEMALLOC_ATTR’ # define JEMALLOC_ALWAYS_INLINE JEMALLOC_ATTR(always_inline) static inline ^ src/jemalloc.c:2027:1: 附注:in expansion of macro ‘JEMALLOC_ALWAYS_INLINE’ JEMALLOC_ALWAYS_INLINE int ^ include/jemalloc/internal/jemalloc_internal_macros.h:7:34: 错误:expected declaration specifiers before ‘JEMALLOC_ATTR’ # define JEMALLOC_ALWAYS_INLINE JEMALLOC_ATTR(always_inline) static inline ^ src/jemalloc.c:2227:1: 附注:in expansion of macro ‘JEMALLOC_ALWAYS_INLINE’ JEMALLOC_ALWAYS_INLINE bool ^ include/jemalloc/internal/jemalloc_internal_macros.h:7:34: 错误:expected declaration specifiers before ‘JEMALLOC_ATTR’ # define JEMALLOC_ALWAYS_INLINE JEMALLOC_ATTR(always_inline) static inline ^ src/jemalloc.c:2245:1: 附注:in expansion of macro ‘JEMALLOC_ALWAYS_INLINE’ JEMALLOC_ALWAYS_INLINE int ^ src/jemalloc.c:2269:1: 错误:expected declaration specifiers before ‘JEMALLOC_NOINLINE’ JEMALLOC_NOINLINE ^ src/jemalloc.c:2320:1: 错误:未知的类型名‘JEMALLOC_EXPORT’ JEMALLOC_EXPORT JEMALLOC_ALLOCATOR JEMALLOC_RESTRICT_RETURN ^ src/jemalloc.c:2320:36: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘JEMALLOC_RESTRICT_RETURN’ JEMALLOC_EXPORT JEMALLOC_ALLOCATOR JEMALLOC_RESTRICT_RETURN ^ src/jemalloc.c:2391:1: 错误:expected declaration specifiers before ‘JEMALLOC_EXPORT’ JEMALLOC_EXPORT int JEMALLOC_NOTHROW ^ src/jemalloc.c:2430:1: 错误:未知的类型名‘JEMALLOC_EXPORT’ JEMALLOC_EXPORT JEMALLOC_ALLOCATOR JEMALLOC_RESTRICT_RETURN ^ src/jemalloc.c:2430:36: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘JEMALLOC_RESTRICT_RETURN’ JEMALLOC_EXPORT JEMALLOC_ALLOCATOR JEMALLOC_RESTRICT_RETURN ^ src/jemalloc.c:2471:1: 错误:未知的类型名‘JEMALLOC_EXPORT’ JEMALLOC_EXPORT JEMALLOC_ALLOCATOR JEMALLOC_RESTRICT_RETURN ^ src/jemalloc.c:2471:36: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘JEMALLOC_RESTRICT_RETURN’ JEMALLOC_EXPORT JEMALLOC_ALLOCATOR JEMALLOC_RESTRICT_RETURN ^ src/jemalloc.c:2506:22: 错误:expected declaration specifiers or ‘...’ before ‘tsd_t’ irealloc_prof_sample(tsd_t *tsd, void *old_ptr, size_t old_usize, size_t usize, ^ src/jemalloc.c:2507:24: 错误:expected declaration specifiers or ‘...’ before ‘hook_ralloc_args_t’ prof_tctx_t *tctx, hook_ralloc_args_t *hook_args) { ^ In file included from include/jemalloc/internal/jemalloc_preamble.h:34:0, from src/jemalloc.c:2: include/jemalloc/internal/jemalloc_internal_macros.h:7:34: 错误:expected declaration specifiers before ‘JEMALLOC_ATTR’ # define JEMALLOC_ALWAYS_INLINE JEMALLOC_ATTR(always_inline) static inline ^ src/jemalloc.c:2528:1: 附注:in expansion of macro ‘JEMALLOC_ALWAYS_INLINE’ JEMALLOC_ALWAYS_INLINE void * ^ include/jemalloc/internal/jemalloc_internal_macros.h:7:34: 错误:expected declaration specifiers before ‘JEMALLOC_ATTR’ # define JEMALLOC_ALWAYS_INLINE JEMALLOC_ATTR(always_inline) static inline ^ src/jemalloc.c:2555:1: 附注:in expansion of macro ‘JEMALLOC_ALWAYS_INLINE’ JEMALLOC_ALWAYS_INLINE void ^ include/jemalloc/internal/jemalloc_internal_macros.h:7:34: 错误:expected declaration specifiers before ‘JEMALLOC_ATTR’ # define JEMALLOC_ALWAYS_INLINE JEMALLOC_ATTR(always_inline) static inline ^ src/jemalloc.c:2594:1: 附注:in expansion of macro ‘JEMALLOC_ALWAYS_INLINE’ JEMALLOC_ALWAYS_INLINE void ^ src/jemalloc.c:2650:1: 错误:未知的类型名‘JEMALLOC_EXPORT’ JEMALLOC_EXPORT JEMALLOC_ALLOCATOR JEMALLOC_RESTRICT_RETURN ^ src/jemalloc.c:2650:36: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘JEMALLOC_RESTRICT_RETURN’ JEMALLOC_EXPORT JEMALLOC_ALLOCATOR JEMALLOC_RESTRICT_RETURN ^ src/jemalloc.c:2769:1: 错误:expected declaration specifiers before ‘JEMALLOC_NOINLINE’ JEMALLOC_NOINLINE ^ In file included from include/jemalloc/internal/jemalloc_preamble.h:34:0, from src/jemalloc.c:2: include/jemalloc/internal/jemalloc_internal_macros.h:7:34: 错误:expected declaration specifiers before ‘JEMALLOC_ATTR’ # define JEMALLOC_ALWAYS_INLINE JEMALLOC_ATTR(always_inline) static inline ^ src/jemalloc.c:2805:1: 附注:in expansion of macro ‘JEMALLOC_ALWAYS_INLINE’ JEMALLOC_ALWAYS_INLINE ^ src/jemalloc.c:2862:1: 错误:expected declaration specifiers before ‘JEMALLOC_EXPORT’ JEMALLOC_EXPORT void JEMALLOC_NOTHROW ^ src/jemalloc.c:3095:1: 错误:未知的类型名‘JEMALLOC_EXPORT’ JEMALLOC_EXPORT JEMALLOC_ALLOCATOR JEMALLOC_RESTRICT_RETURN ^ src/jemalloc.c:3095:36: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘JEMALLOC_RESTRICT_RETURN’ JEMALLOC_EXPORT JEMALLOC_ALLOCATOR JEMALLOC_RESTRICT_RETURN ^ src/jemalloc.c:3149:22: 错误:expected declaration specifiers or ‘...’ before ‘tsdn_t’ irallocx_prof_sample(tsdn_t *tsdn, void *old_ptr, size_t old_usize, ^ src/jemalloc.c:3151:24: 错误:expected declaration specifiers or ‘...’ before ‘hook_ralloc_args_t’ prof_tctx_t *tctx, hook_ralloc_args_t *hook_args) { ^ In file included from include/jemalloc/internal/jemalloc_preamble.h:34:0, from src/jemalloc.c:2: include/jemalloc/internal/jemalloc_internal_macros.h:7:34: 错误:expected declaration specifiers before ‘JEMALLOC_ATTR’ # define JEMALLOC_ALWAYS_INLINE JEMALLOC_ATTR(always_inline) static inline ^ src/jemalloc.c:3173:1: 附注:in expansion of macro ‘JEMALLOC_ALWAYS_INLINE’ JEMALLOC_ALWAYS_INLINE void * ^ src/jemalloc.c:3213:1: 错误:未知的类型名‘JEMALLOC_EXPORT’ JEMALLOC_EXPORT JEMALLOC_ALLOCATOR JEMALLOC_RESTRICT_RETURN ^ src/jemalloc.c:3213:36: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘JEMALLOC_RESTRICT_RETURN’ JEMALLOC_EXPORT JEMALLOC_ALLOCATOR JEMALLOC_RESTRICT_RETURN ^ In file included from include/jemalloc/internal/jemalloc_preamble.h:34:0, from src/jemalloc.c:2: include/jemalloc/internal/jemalloc_internal_macros.h:7:34: 错误:expected declaration specifiers before ‘JEMALLOC_ATTR’ # define JEMALLOC_ALWAYS_INLINE JEMALLOC_ATTR(always_inline) static inline ^ src/jemalloc.c:3311:1: 附注:in expansion of macro ‘JEMALLOC_ALWAYS_INLINE’ JEMALLOC_ALWAYS_INLINE size_t ^ src/jemalloc.c:3325:22: 错误:expected declaration specifiers or ‘...’ before ‘tsdn_t’ ixallocx_prof_sample(tsdn_t *tsdn, void *ptr, size_t old_usize, size_t size, ^ In file included from include/jemalloc/internal/jemalloc_preamble.h:34:0, from src/jemalloc.c:2: include/jemalloc/internal/jemalloc_internal_macros.h:7:34: 错误:expected declaration specifiers before ‘JEMALLOC_ATTR’ # define JEMALLOC_ALWAYS_INLINE JEMALLOC_ATTR(always_inline) static inline ^ src/jemalloc.c:3338:1: 附注:in expansion of macro ‘JEMALLOC_ALWAYS_INLINE’ JEMALLOC_ALWAYS_INLINE size_t ^ src/jemalloc.c:3389:1: 错误:未知的类型名‘JEMALLOC_EXPORT’ JEMALLOC_EXPORT size_t JEMALLOC_NOTHROW ^ src/jemalloc.c:3389:24: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘JEMALLOC_NOTHROW’ JEMALLOC_EXPORT size_t JEMALLOC_NOTHROW ^ src/jemalloc.c:3459:1: 错误:未知的类型名‘JEMALLOC_EXPORT’ JEMALLOC_EXPORT size_t JEMALLOC_NOTHROW ^ src/jemalloc.c:3459:24: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘JEMALLOC_NOTHROW’ JEMALLOC_EXPORT size_t JEMALLOC_NOTHROW ^ src/jemalloc.c:3486:1: 错误:expected declaration specifiers before ‘JEMALLOC_EXPORT’ JEMALLOC_EXPORT void JEMALLOC_NOTHROW ^ In file included from include/jemalloc/internal/jemalloc_preamble.h:34:0, from src/jemalloc.c:2: include/jemalloc/internal/jemalloc_internal_macros.h:7:34: 错误:expected declaration specifiers before ‘JEMALLOC_ATTR’ # define JEMALLOC_ALWAYS_INLINE JEMALLOC_ATTR(always_inline) static inline ^ src/jemalloc.c:3533:1: 附注:in expansion of macro ‘JEMALLOC_ALWAYS_INLINE’ JEMALLOC_ALWAYS_INLINE size_t ^ src/jemalloc.c:3547:1: 错误:expected declaration specifiers before ‘JEMALLOC_NOINLINE’ JEMALLOC_NOINLINE void ^ src/jemalloc.c:3593:1: 错误:expected declaration specifiers before ‘JEMALLOC_EXPORT’ JEMALLOC_EXPORT void JEMALLOC_NOTHROW ^ src/jemalloc.c:3606:1: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘je_sdallocx_noflags’ je_sdallocx_noflags(void *ptr, size_t size) { ^ src/jemalloc.c:3617:1: 错误:未知的类型名‘JEMALLOC_EXPORT’ JEMALLOC_EXPORT size_t JEMALLOC_NOTHROW ^ src/jemalloc.c:3617:24: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘JEMALLOC_NOTHROW’ JEMALLOC_EXPORT size_t JEMALLOC_NOTHROW ^ src/jemalloc.c:3644:1: 错误:expected declaration specifiers before ‘JEMALLOC_EXPORT’ JEMALLOC_EXPORT int JEMALLOC_NOTHROW ^ src/jemalloc.c:3666:1: 错误:expected declaration specifiers before ‘JEMALLOC_EXPORT’ JEMALLOC_EXPORT int JEMALLOC_NOTHROW ^ src/jemalloc.c:3686:1: 错误:expected declaration specifiers before ‘JEMALLOC_EXPORT’ JEMALLOC_EXPORT int JEMALLOC_NOTHROW ^ src/jemalloc.c:3707:1: 错误:expected declaration specifiers before ‘JEMALLOC_EXPORT’ JEMALLOC_EXPORT void JEMALLOC_NOTHROW ^ src/jemalloc.c:3721:1: 错误:未知的类型名‘JEMALLOC_EXPORT’ JEMALLOC_EXPORT size_t JEMALLOC_NOTHROW ^ src/jemalloc.c:3721:24: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘JEMALLOC_NOTHROW’ JEMALLOC_EXPORT size_t JEMALLOC_NOTHROW ^ src/jemalloc.c:3772:1: 错误:expected declaration specifiers before ‘JEMALLOC_ATTR’ JEMALLOC_ATTR(constructor) ^ src/jemalloc.c:3786:1: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token { ^ src/jemalloc.c:3860:1: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token { ^ src/jemalloc.c:3894:31: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token jemalloc_postfork_child(void) { ^ src/jemalloc.c:3927:1: 错误:expected declaration specifiers before ‘JEMALLOC_EXPORT’ JEMALLOC_EXPORT int JEMALLOC_NOTHROW ^ In file included from include/jemalloc/internal/assert.h:1:0, from include/jemalloc/internal/bit_util.h:4, from include/jemalloc/internal/bitmap.h:5, from include/jemalloc/internal/arena_structs_a.h:4, from include/jemalloc/internal/jemalloc_internal_includes.h:53, from src/jemalloc.c:3: include/jemalloc/internal/malloc_io.h:54:8: 错误:原型函数定义中使用了旧式参数声明 size_t malloc_snprintf(char *str, size_t size, const char *format, ...) ^ src/jemalloc.c:3931:1: 错误:expected ‘{’ at end of input } ^ src/jemalloc.c:3931:1: 警告:在有返回值的函数中,控制流程到达函数尾 [-Wreturn-type] } ^ make: *** [src/jemalloc.sym.o] 错误 1
最新发布
09-24
make -C /lib/modules/4.9.337-tegra/build M=/APP_linux_01/Xilinx_Answer_65444_Linux_Files/driver modules make[1]: Entering directory &#39;/usr/src/linux-headers-4.9.337-tegra-ubuntu18.04_aarch64/kernel-4.9&#39; CC [M] /APP_linux_01/Xilinx_Answer_65444_Linux_Files/driver/xdma-core.o CC [M] /APP_linux_01/Xilinx_Answer_65444_Linux_Files/driver/xdma-sgm.o In file included from ./include/linux/kernel.h:13:0, from ./include/linux/list.h:8, from ./include/linux/kobject.h:20, from ./include/linux/cdev.h:4, from /APP_linux_01/Xilinx_Answer_65444_Linux_Files/driver/xdma-sgm.c:10: /APP_linux_01/Xilinx_Answer_65444_Linux_Files/driver/xdma-sgm.c: In function ‘sgm_get_user_pages’: /APP_linux_01/Xilinx_Answer_65444_Linux_Files/driver/xdma-sgm.c:184:11: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 3 has typesize_t {aka long unsigned int}’ [-Wformat=] pr_debug("sg_dma_len(&sgl[0])=0x%08x.\n", sg_dma_len(&sgl[0])); ^ ./include/linux/printk.h:271:21: note: in definition of macro ‘pr_fmt’ #define pr_fmt(fmt) fmt ^~~ ./include/linux/printk.h:319:2: note: in expansion of macro ‘dynamic_pr_debug’ dynamic_pr_debug(fmt, ##__VA_ARGS__) ^~~~~~~~~~~~~~~~ /APP_linux_01/Xilinx_Answer_65444_Linux_Files/driver/xdma-sgm.c:184:2: note: in expansion of macro ‘pr_debug’ pr_debug("sg_dma_len(&sgl[0])=0x%08x.\n", sg_dma_len(&sgl[0])); ^~~~~~~~ /APP_linux_01/Xilinx_Answer_65444_Linux_Files/driver/xdma-sgm.c:190:12: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 6 has type ‘long unsigned int’ [-Wformat=] pr_debug("%04d: page=0x%p, pfn=%lu, offset=%u, length=%u (FIRST)\n", 0, ^ ./include/linux/printk.h:271:21: note: in definition of macro ‘pr_fmt’ #define pr_fmt(fmt) fmt ^~~ ./include/linux/printk.h:319:2: note: in expansion of macro ‘dynamic_pr_debug’ dynamic_pr_debug(fmt, ##__VA_ARGS__) ^~~~~~~~~~~~~~~~ /APP_linux_01/Xilinx_Answer_65444_Linux_Files/driver/xdma-sgm.c:190:3: note: in expansion of macro ‘pr_debug’ pr_debug("%04d: page=0x%p, pfn=%lu, offset=%u, length=%u (FIRST)\n", 0, ^~~~~~~~ /APP_linux_01/Xilinx_Answer_65444_Linux_Files/driver/xdma-sgm.c:190:12: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 7 has typesize_t {aka long unsigned int}’ [-Wformat=] pr_debug("%04d: page=0x%p, pfn=%lu, offset=%u, length=%u (FIRST)\n", 0, ^ ./include/linux/printk.h:271:21: note: in definition of macro ‘pr_fmt’ #define pr_fmt(fmt) fmt ^~~ ./include/linux/printk.h:319:2: note: in expansion of macro ‘dynamic_pr_debug’ dynamic_pr_debug(fmt, ##__VA_ARGS__) ^~~~~~~~~~~~~~~~ /APP_linux_01/Xilinx_Answer_65444_Linux_Files/driver/xdma-sgm.c:190:3: note: in expansion of macro ‘pr_debug’ pr_debug("%04d: page=0x%p, pfn=%lu, offset=%u, length=%u (FIRST)\n", 0, ^~~~~~~~ /APP_linux_01/Xilinx_Answer_65444_Linux_Files/driver/xdma-sgm.c:199:13: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 6 has type ‘long unsigned int’ [-Wformat=] pr_debug("%04d: page=0x%p, pfn=%lu, offset=%u, length=%u\n", i, ^ ./include/linux/printk.h:271:21: note: in definition of macro ‘pr_fmt’ #define pr_fmt(fmt) fmt ^~~ ./include/linux/printk.h:319:2: note: in expansion of macro ‘dynamic_pr_debug’ dynamic_pr_debug(fmt, ##__VA_ARGS__) ^~~~~~~~~~~~~~~~ /APP_linux_01/Xilinx_Answer_65444_Linux_Files/driver/xdma-sgm.c:199:4: note: in expansion of macro ‘pr_debug’ pr_debug("%04d: page=0x%p, pfn=%lu, offset=%u, length=%u\n", i, ^~~~~~~~ /APP_linux_01/Xilinx_Answer_65444_Linux_Files/driver/xdma-sgm.c:199:13: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 7 has typesize_t {aka long unsigned int}’ [-Wformat=] pr_debug("%04d: page=0x%p, pfn=%lu, offset=%u, length=%u\n", i, ^ ./include/linux/printk.h:271:21: note: in definition of macro ‘pr_fmt’ #define pr_fmt(fmt) fmt ^~~ ./include/linux/printk.h:319:2: note: in expansion of macro ‘dynamic_pr_debug’ dynamic_pr_debug(fmt, ##__VA_ARGS__) ^~~~~~~~~~~~~~~~ /APP_linux_01/Xilinx_Answer_65444_Linux_Files/driver/xdma-sgm.c:199:4: note: in expansion of macro ‘pr_debug’ pr_debug("%04d: page=0x%p, pfn=%lu, offset=%u, length=%u\n", i, ^~~~~~~~ /APP_linux_01/Xilinx_Answer_65444_Linux_Files/driver/xdma-sgm.c:206:12: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 6 has type ‘long unsigned int’ [-Wformat=] pr_debug("%04d: page=0x%p, pfn=%lu, offset=%u, length=%u (LAST)\n", i, ^ ./include/linux/printk.h:271:21: note: in definition of macro ‘pr_fmt’ #define pr_fmt(fmt) fmt ^~~ ./include/linux/printk.h:319:2: note: in expansion of macro ‘dynamic_pr_debug’ dynamic_pr_debug(fmt, ##__VA_ARGS__) ^~~~~~~~~~~~~~~~ /APP_linux_01/Xilinx_Answer_65444_Linux_Files/driver/xdma-sgm.c:206:3: note: in expansion of macro ‘pr_debug’ pr_debug("%04d: page=0x%p, pfn=%lu, offset=%u, length=%u (LAST)\n", i, ^~~~~~~~ /APP_linux_01/Xilinx_Answer_65444_Linux_Files/driver/xdma-sgm.c:206:12: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 7 has typesize_t {aka long unsigned int}’ [-Wformat=] pr_debug("%04d: page=0x%p, pfn=%lu, offset=%u, length=%u (LAST)\n", i, ^ ./include/linux/printk.h:271:21: note: in definition of macro ‘pr_fmt’ #define pr_fmt(fmt) fmt ^~~ ./include/linux/printk.h:319:2: note: in expansion of macro ‘dynamic_pr_debug’ dynamic_pr_debug(fmt, ##__VA_ARGS__) ^~~~~~~~~~~~~~~~ /APP_linux_01/Xilinx_Answer_65444_Linux_Files/driver/xdma-sgm.c:206:3: note: in expansion of macro ‘pr_debug’ pr_debug("%04d: page=0x%p, pfn=%lu, offset=%u, length=%u (LAST)\n", i, ^~~~~~~~ /APP_linux_01/Xilinx_Answer_65444_Linux_Files/driver/xdma-sgm.c:213:12: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 6 has type ‘long unsigned int’ [-Wformat=] pr_debug("%04d: page=0x%p, pfn=%lu, offset=%u, length=%u (SINGLE/FIRST/LAST)\n", 0, ^ ./include/linux/printk.h:271:21: note: in definition of macro ‘pr_fmt’ #define pr_fmt(fmt) fmt ^~~ ./include/linux/printk.h:319:2: note: in expansion of macro ‘dynamic_pr_debug’ dynamic_pr_debug(fmt, ##__VA_ARGS__) ^~~~~~~~~~~~~~~~ /APP_linux_01/Xilinx_Answer_65444_Linux_Files/driver/xdma-sgm.c:213:3: note: in expansion of macro ‘pr_debug’ pr_debug("%04d: page=0x%p, pfn=%lu, offset=%u, length=%u (SINGLE/FIRST/LAST)\n", 0, ^~~~~~~~ /APP_linux_01/Xilinx_Answer_65444_Linux_Files/driver/xdma-sgm.c:213:12: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 7 has typesize_t {aka long unsigned int}’ [-Wformat=] pr_debug("%04d: page=0x%p, pfn=%lu, offset=%u, length=%u (SINGLE/FIRST/LAST)\n", 0, ^ ./include/linux/printk.h:271:21: note: in definition of macro ‘pr_fmt’ #define pr_fmt(fmt) fmt ^~~ ./include/linux/printk.h:319:2: note: in expansion of macro ‘dynamic_pr_debug’ dynamic_pr_debug(fmt, ##__VA_ARGS__) ^~~~~~~~~~~~~~~~ /APP_linux_01/Xilinx_Answer_65444_Linux_Files/driver/xdma-sgm.c:213:3: note: in expansion of macro ‘pr_debug’ pr_debug("%04d: page=0x%p, pfn=%lu, offset=%u, length=%u (SINGLE/FIRST/LAST)\n", 0, ^~~~~~~~ /APP_linux_01/Xilinx_Answer_65444_Linux_Files/driver/xdma-sgm.c: In function ‘sgm_kernel_pages’: /APP_linux_01/Xilinx_Answer_65444_Linux_Files/driver/xdma-sgm.c:322:11: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 3 has typesize_t {aka long unsigned int}’ [-Wformat=] pr_debug("sg_dma_len(&sgl[0])=0x%08x.\n", sg_dma_len(&sgl[0])); ^ ./include/linux/printk.h:271:21: note: in definition of macro ‘pr_fmt’ #define pr_fmt(fmt) fmt ^~~ ./include/linux/printk.h:319:2: note: in expansion of macro ‘dynamic_pr_debug’ dynamic_pr_debug(fmt, ##__VA_ARGS__) ^~~~~~~~~~~~~~~~ /APP_linux_01/Xilinx_Answer_65444_Linux_Files/driver/xdma-sgm.c:322:2: note: in expansion of macro ‘pr_debug’ pr_debug("sg_dma_len(&sgl[0])=0x%08x.\n", sg_dma_len(&sgl[0])); ^~~~~~~~ /APP_linux_01/Xilinx_Answer_65444_Linux_Files/driver/xdma-sgm.c:328:12: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 6 has type ‘long unsigned int’ [-Wformat=] pr_debug("%04d: page=0x%p, pfn=%lu, offset=%u length=%u (F)\n", 0, ^ ./include/linux/printk.h:271:21: note: in definition of macro ‘pr_fmt’ #define pr_fmt(fmt) fmt ^~~ ./include/linux/printk.h:319:2: note: in expansion of macro ‘dynamic_pr_debug’ dynamic_pr_debug(fmt, ##__VA_ARGS__) ^~~~~~~~~~~~~~~~ /APP_linux_01/Xilinx_Answer_65444_Linux_Files/driver/xdma-sgm.c:328:3: note: in expansion of macro ‘pr_debug’ pr_debug("%04d: page=0x%p, pfn=%lu, offset=%u length=%u (F)\n", 0, ^~~~~~~~ /APP_linux_01/Xilinx_Answer_65444_Linux_Files/driver/xdma-sgm.c:328:12: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 7 has typesize_t {aka long unsigned int}’ [-Wformat=] pr_debug("%04d: page=0x%p, pfn=%lu, offset=%u length=%u (F)\n", 0, ^ ./include/linux/printk.h:271:21: note: in definition of macro ‘pr_fmt’ #define pr_fmt(fmt) fmt ^~~ ./include/linux/printk.h:319:2: note: in expansion of macro ‘dynamic_pr_debug’ dynamic_pr_debug(fmt, ##__VA_ARGS__) ^~~~~~~~~~~~~~~~ /APP_linux_01/Xilinx_Answer_65444_Linux_Files/driver/xdma-sgm.c:328:3: note: in expansion of macro ‘pr_debug’ pr_debug("%04d: page=0x%p, pfn=%lu, offset=%u length=%u (F)\n", 0, ^~~~~~~~ /APP_linux_01/Xilinx_Answer_65444_Linux_Files/driver/xdma-sgm.c:337:13: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 6 has type ‘long unsigned int’ [-Wformat=] pr_debug("%04d: page=0x%p, pfn=%lu, offset=%u length=%u\n", i, ^ ./include/linux/printk.h:271:21: note: in definition of macro ‘pr_fmt’ #define pr_fmt(fmt) fmt ^~~ ./include/linux/printk.h:319:2: note: in expansion of macro ‘dynamic_pr_debug’ dynamic_pr_debug(fmt, ##__VA_ARGS__) ^~~~~~~~~~~~~~~~ /APP_linux_01/Xilinx_Answer_65444_Linux_Files/driver/xdma-sgm.c:337:4: note: in expansion of macro ‘pr_debug’ pr_debug("%04d: page=0x%p, pfn=%lu, offset=%u length=%u\n", i, ^~~~~~~~ /APP_linux_01/Xilinx_Answer_65444_Linux_Files/driver/xdma-sgm.c:337:13: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 7 has typesize_t {aka long unsigned int}’ [-Wformat=] pr_debug("%04d: page=0x%p, pfn=%lu, offset=%u length=%u\n", i, ^ ./include/linux/printk.h:271:21: note: in definition of macro ‘pr_fmt’ #define pr_fmt(fmt) fmt ^~~ ./include/linux/printk.h:319:2: note: in expansion of macro ‘dynamic_pr_debug’ dynamic_pr_debug(fmt, ##__VA_ARGS__) ^~~~~~~~~~~~~~~~ /APP_linux_01/Xilinx_Answer_65444_Linux_Files/driver/xdma-sgm.c:337:4: note: in expansion of macro ‘pr_debug’ pr_debug("%04d: page=0x%p, pfn=%lu, offset=%u length=%u\n", i, ^~~~~~~~ /APP_linux_01/Xilinx_Answer_65444_Linux_Files/driver/xdma-sgm.c:344:12: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 5 has type ‘long unsigned int’ [-Wformat=] pr_debug("%04d: pfn=%lu, offset=%u length=%u (L)\n", i, ^ ./include/linux/printk.h:271:21: note: in definition of macro ‘pr_fmt’ #define pr_fmt(fmt) fmt ^~~ ./include/linux/printk.h:319:2: note: in expansion of macro ‘dynamic_pr_debug’ dynamic_pr_debug(fmt, ##__VA_ARGS__) ^~~~~~~~~~~~~~~~ /APP_linux_01/Xilinx_Answer_65444_Linux_Files/driver/xdma-sgm.c:344:3: note: in expansion of macro ‘pr_debug’ pr_debug("%04d: pfn=%lu, offset=%u length=%u (L)\n", i, ^~~~~~~~ /APP_linux_01/Xilinx_Answer_65444_Linux_Files/driver/xdma-sgm.c:344:12: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 6 has typesize_t {aka long unsigned int}’ [-Wformat=] pr_debug("%04d: pfn=%lu, offset=%u length=%u (L)\n", i, ^ ./include/linux/printk.h:271:21: note: in definition of macro ‘pr_fmt’ #define pr_fmt(fmt) fmt ^~~ ./include/linux/printk.h:319:2: note: in expansion of macro ‘dynamic_pr_debug’ dynamic_pr_debug(fmt, ##__VA_ARGS__) ^~~~~~~~~~~~~~~~ /APP_linux_01/Xilinx_Answer_65444_Linux_Files/driver/xdma-sgm.c:344:3: note: in expansion of macro ‘pr_debug’ pr_debug("%04d: pfn=%lu, offset=%u length=%u (L)\n", i, ^~~~~~~~ /APP_linux_01/Xilinx_Answer_65444_Linux_Files/driver/xdma-sgm.c:351:12: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 5 has type ‘long unsigned int’ [-Wformat=] pr_debug("%04d: pfn=%lu, offset=%u length=%u (F)\n", 0, ^ ./include/linux/printk.h:271:21: note: in definition of macro ‘pr_fmt’ #define pr_fmt(fmt) fmt ^~~ ./include/linux/printk.h:319:2: note: in expansion of macro ‘dynamic_pr_debug’ dynamic_pr_debug(fmt, ##__VA_ARGS__) ^~~~~~~~~~~~~~~~ /APP_linux_01/Xilinx_Answer_65444_Linux_Files/driver/xdma-sgm.c:351:3: note: in expansion of macro ‘pr_debug’ pr_debug("%04d: pfn=%lu, offset=%u length=%u (F)\n", 0, ^~~~~~~~ /APP_linux_01/Xilinx_Answer_65444_Linux_Files/driver/xdma-sgm.c:351:12: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 6 has typesize_t {aka long unsigned int}’ [-Wformat=] pr_debug("%04d: pfn=%lu, offset=%u length=%u (F)\n", 0, ^ ./include/linux/printk.h:271:21: note: in definition of macro ‘pr_fmt’ #define pr_fmt(fmt) fmt ^~~ ./include/linux/printk.h:319:2: note: in expansion of macro ‘dynamic_pr_debug’ dynamic_pr_debug(fmt, ##__VA_ARGS__) ^~~~~~~~~~~~~~~~ /APP_linux_01/Xilinx_Answer_65444_Linux_Files/driver/xdma-sgm.c:351:3: note: in expansion of macro ‘pr_debug’ pr_debug("%04d: pfn=%lu, offset=%u length=%u (F)\n", 0, ^~~~~~~~ CC [M] /APP_linux_01/Xilinx_Answer_65444_Linux_Files/driver/xdma-ioctl.o CC [M] /APP_linux_01/Xilinx_Answer_65444_Linux_Files/driver/xdma-bit.o LD [M] /APP_linux_01/Xilinx_Answer_65444_Linux_Files/driver/xdma.o Building modules, stage 2. MODPOST 1 modules CC /APP_linux_01/Xilinx_Answer_65444_Linux_Files/driver/xdma.mod.o LD [M] /APP_linux_01/Xilinx_Answer_65444_Linux_Files/driver/xdma.ko make[1]: Leaving directory &#39;/usr/src/linux-headers-4.9.337-tegra-ubuntu18.04_aarch64/kernel-4.9&#39;
06-18
Executing action: all (aliases: build) Running ninja in directory /home/wokwi/esp-project-esp32s3/build Executing "ninja all"... [1/9] Performing build step for &#39;bootloader&#39; [1/1] cd /home/wokwi/esp-project-esp32s3/build/bootloader/esp-idf/esptool_py && /opt/esp/python_env/idf5.3_py3.10_env/bin/python /opt/esp/idf/components/partition_table/check_sizes.py --offset 0x8000 bootloader 0x0 /home/wokwi/esp-project-esp32s3/build/bootloader/bootloader.bin Bootloader binary size 0x5260 bytes. 0x2da0 bytes (36%) free. [2/7] Building C object esp-idf/main/CMakeFiles/__idf_main.dir/src/main.c.obj FAILED: esp-idf/main/CMakeFiles/__idf_main.dir/src/main.c.obj ccache /opt/esp/tools/xtensa-esp-elf/esp-13.2.0_20240530/xtensa-esp-elf/bin/xtensa-esp32s3-elf-gcc -DESP_PLATFORM -DIDF_VER=\"v5.3.1\" -DMBEDTLS_CONFIG_FILE=\"mbedtls/esp_config.h\" -DSOC_MMU_PAGE_SIZE=CONFIG_MMU_PAGE_SIZE -DSOC_XTAL_FREQ_MHZ=CONFIG_XTAL_FREQ -DUNITY_INCLUDE_CONFIG_H -D_GLIBCXX_HAVE_POSIX_SEMAPHORE -D_GLIBCXX_USE_POSIX_SEMAPHORE -D_GNU_SOURCE -D_POSIX_READER_WRITER_LOCKS -I/home/wokwi/esp-project-esp32s3/build/config -I/home/wokwi/esp-project-esp32s3/main/src -I/opt/esp/idf/components/newlib/platform_include -I/opt/esp/idf/components/freertos/config/include -I/opt/esp/idf/components/freertos/config/include/freertos -I/opt/esp/idf/components/freertos/config/xtensa/include -I/opt/esp/idf/components/freertos/FreeRTOS-Kernel/include -I/opt/esp/idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/include -I/opt/esp/idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/include/freertos -I/opt/esp/idf/components/freertos/esp_additions/include -I/opt/esp/idf/components/esp_hw_support/include -I/opt/esp/idf/components/esp_hw_support/include/soc -I/opt/esp/idf/components/esp_hw_support/include/soc/esp32s3 -I/opt/esp/idf/components/esp_hw_support/dma/include -I/opt/esp/idf/components/esp_hw_support/ldo/include -I/opt/esp/idf/components/esp_hw_support/port/esp32s3/. -I/opt/esp/idf/components/esp_hw_support/port/esp32s3/include -I/opt/esp/idf/components/heap/include -I/opt/esp/idf/components/log/include -I/opt/esp/idf/components/soc/include -I/opt/esp/idf/components/soc/esp32s3 -I/opt/esp/idf/components/soc/esp32s3/include -I/opt/esp/idf/components/hal/platform_port/include -I/opt/esp/idf/components/hal/esp32s3/include -I/opt/esp/idf/components/hal/include -I/opt/esp/idf/components/esp_rom/include -I/opt/esp/idf/components/esp_rom/include/esp32s3 -I/opt/esp/idf/components/esp_rom/esp32s3 -I/opt/esp/idf/components/esp_common/include -I/opt/esp/idf/components/esp_system/include -I/opt/esp/idf/components/esp_system/port/soc -I/opt/esp/idf/components/esp_system/port/include/private -I/opt/esp/idf/components/xtensa/esp32s3/include -I/opt/esp/idf/components/xtensa/include -I/opt/esp/idf/components/xtensa/deprecated_include -I/opt/esp/idf/components/lwip/include -I/opt/esp/idf/components/lwip/include/apps -I/opt/esp/idf/components/lwip/include/apps/sntp -I/opt/esp/idf/components/lwip/lwip/src/include -I/opt/esp/idf/components/lwip/port/include -I/opt/esp/idf/components/lwip/port/freertos/include -I/opt/esp/idf/components/lwip/port/esp32xx/include -I/opt/esp/idf/components/lwip/port/esp32xx/include/arch -I/opt/esp/idf/components/lwip/port/esp32xx/include/sys -I/opt/esp/idf/components/esp_driver_gpio/include -I/opt/esp/idf/components/esp_pm/include -I/opt/esp/idf/components/mbedtls/port/include -I/opt/esp/idf/components/mbedtls/mbedtls/include -I/opt/esp/idf/components/mbedtls/mbedtls/library -I/opt/esp/idf/components/mbedtls/esp_crt_bundle/include -I/opt/esp/idf/components/mbedtls/mbedtls/3rdparty/everest/include -I/opt/esp/idf/components/mbedtls/mbedtls/3rdparty/p256-m -I/opt/esp/idf/components/mbedtls/mbedtls/3rdparty/p256-m/p256-m -I/opt/esp/idf/components/esp_app_format/include -I/opt/esp/idf/components/esp_bootloader_format/include -I/opt/esp/idf/components/app_update/include -I/opt/esp/idf/components/bootloader_support/include -I/opt/esp/idf/components/bootloader_support/bootloader_flash/include -I/opt/esp/idf/components/esp_partition/include -I/opt/esp/idf/components/efuse/include -I/opt/esp/idf/components/efuse/esp32s3/include -I/opt/esp/idf/components/esp_mm/include -I/opt/esp/idf/components/spi_flash/include -I/opt/esp/idf/components/pthread/include -I/opt/esp/idf/components/esp_timer/include -I/opt/esp/idf/components/esp_driver_gptimer/include -I/opt/esp/idf/components/esp_ringbuf/include -I/opt/esp/idf/components/esp_driver_uart/include -I/opt/esp/idf/components/vfs/include -I/opt/esp/idf/components/app_trace/include -I/opt/esp/idf/components/esp_event/include -I/opt/esp/idf/components/nvs_flash/include -I/opt/esp/idf/components/esp_driver_pcnt/include -I/opt/esp/idf/components/esp_driver_spi/include -I/opt/esp/idf/components/esp_driver_mcpwm/include -I/opt/esp/idf/components/esp_driver_ana_cmpr/include -I/opt/esp/idf/components/esp_driver_i2s/include -I/opt/esp/idf/components/sdmmc/include -I/opt/esp/idf/components/esp_driver_sdmmc/include -I/opt/esp/idf/components/esp_driver_sdspi/include -I/opt/esp/idf/components/esp_driver_sdio/include -I/opt/esp/idf/components/esp_driver_dac/include -I/opt/esp/idf/components/esp_driver_rmt/include -I/opt/esp/idf/components/esp_driver_tsens/include -I/opt/esp/idf/components/esp_driver_sdm/include -I/opt/esp/idf/components/esp_driver_i2c/include -I/opt/esp/idf/components/esp_driver_ledc/include -I/opt/esp/idf/components/esp_driver_parlio/include -I/opt/esp/idf/components/esp_driver_usb_serial_jtag/include -I/opt/esp/idf/components/driver/deprecated -I/opt/esp/idf/components/driver/i2c/include -I/opt/esp/idf/components/driver/touch_sensor/include -I/opt/esp/idf/components/driver/twai/include -I/opt/esp/idf/components/driver/touch_sensor/esp32s3/include -I/opt/esp/idf/components/esp_phy/include -I/opt/esp/idf/components/esp_phy/esp32s3/include -I/opt/esp/idf/components/esp_vfs_console/include -I/opt/esp/idf/components/esp_netif/include -I/opt/esp/idf/components/wpa_supplicant/include -I/opt/esp/idf/components/wpa_supplicant/port/include -I/opt/esp/idf/components/wpa_supplicant/esp_supplicant/include -I/opt/esp/idf/components/esp_coex/include -I/opt/esp/idf/components/esp_wifi/include -I/opt/esp/idf/components/esp_wifi/wifi_apps/include -I/opt/esp/idf/components/esp_wifi/wifi_apps/nan_app/include -I/opt/esp/idf/components/esp_wifi/include/local -I/opt/esp/idf/components/unity/include -I/opt/esp/idf/components/unity/unity/src -I/opt/esp/idf/components/cmock/CMock/src -I/opt/esp/idf/components/console -I/opt/esp/idf/components/http_parser -I/opt/esp/idf/components/esp-tls -I/opt/esp/idf/components/esp-tls/esp-tls-crypto -I/opt/esp/idf/components/esp_adc/include -I/opt/esp/idf/components/esp_adc/interface -I/opt/esp/idf/components/esp_adc/esp32s3/include -I/opt/esp/idf/components/esp_adc/deprecated/include -I/opt/esp/idf/components/esp_driver_isp/include -I/opt/esp/idf/components/esp_driver_cam/include -I/opt/esp/idf/components/esp_driver_cam/interface -I/opt/esp/idf/components/esp_driver_jpeg/include -I/opt/esp/idf/components/esp_driver_ppa/include -I/opt/esp/idf/components/esp_eth/include -I/opt/esp/idf/components/esp_gdbstub/include -I/opt/esp/idf/components/esp_hid/include -I/opt/esp/idf/components/tcp_transport/include -I/opt/esp/idf/components/esp_http_client/include -I/opt/esp/idf/components/esp_http_server/include -I/opt/esp/idf/components/esp_https_ota/include -I/opt/esp/idf/components/esp_https_server/include -I/opt/esp/idf/components/esp_psram/include -I/opt/esp/idf/components/esp_lcd/include -I/opt/esp/idf/components/esp_lcd/interface -I/opt/esp/idf/components/esp_lcd/rgb/include -I/opt/esp/idf/components/protobuf-c/protobuf-c -I/opt/esp/idf/components/protocomm/include/common -I/opt/esp/idf/components/protocomm/include/security -I/opt/esp/idf/components/protocomm/include/transports -I/opt/esp/idf/components/protocomm/include/crypto/srp6a -I/opt/esp/idf/components/protocomm/proto-c -I/opt/esp/idf/components/esp_local_ctrl/include -I/opt/esp/idf/components/espcoredump/include -I/opt/esp/idf/components/espcoredump/include/port/xtensa -I/opt/esp/idf/components/wear_levelling/include -I/opt/esp/idf/components/fatfs/diskio -I/opt/esp/idf/components/fatfs/src -I/opt/esp/idf/components/fatfs/vfs -I/opt/esp/idf/components/idf_test/include -I/opt/esp/idf/components/idf_test/include/esp32s3 -I/opt/esp/idf/components/ieee802154/include -I/opt/esp/idf/components/json/cJSON -I/opt/esp/idf/components/mqtt/esp-mqtt/include -I/opt/esp/idf/components/nvs_sec_provider/include -I/opt/esp/idf/components/perfmon/include -I/opt/esp/idf/components/spiffs/include -I/opt/esp/idf/components/touch_element/include -I/opt/esp/idf/components/usb/include -I/opt/esp/idf/components/wifi_provisioning/include -mlongcalls -fno-builtin-memcpy -fno-builtin-memset -fno-builtin-bzero -fno-builtin-stpcpy -fno-builtin-strncpy -fdiagnostics-color=always -ffunction-sections -fdata-sections -Wall -Werror=all -Wno-error=unused-function -Wno-error=unused-variable -Wno-error=unused-but-set-variable -Wno-error=deprecated-declarations -Wextra -Wno-unused-parameter -Wno-sign-compare -Wno-enum-conversion -gdwarf-4 -ggdb -Og -fno-shrink-wrap -fmacro-prefix-map=/home/wokwi/esp-project-esp32s3=. -fmacro-prefix-map=/opt/esp/idf=/IDF -fstrict-volatile-bitfields -fno-jump-tables -fno-tree-switch-conversion -std=gnu17 -Wno-old-style-declaration -MD -MT esp-idf/main/CMakeFiles/__idf_main.dir/src/main.c.obj -MF esp-idf/main/CMakeFiles/__idf_main.dir/src/main.c.obj.d -o esp-idf/main/CMakeFiles/__idf_main.dir/src/main.c.obj -c /home/wokwi/esp-project-esp32s3/main/src/main.c /home/wokwi/esp-project-esp32s3/main/src/main.c: In function &#39;app_main&#39;: /home/wokwi/esp-project-esp32s3/main/src/main.c:33:10: error: &#39;ledc_timer_config_t&#39; has no member named &#39;timer_bit_num&#39;; did you mean &#39;timer_num&#39;? 33 | .timer_bit_num = LEDC_DUTY_RES, | ^~~~~~~~~~~~~ | timer_num /home/wokwi/esp-project-esp32s3/main/src/main.c:56:45: error: format &#39;%d&#39; expects argument of type &#39;int&#39;, but argument 3 has type &#39;uint32_t&#39; {aka &#39;long unsigned int&#39;} [-Werror=format=] 56 | printf("设置角度: %d°, 占空比: %d\n", angle, duty); | ~^ ~~~~ | | | | int uint32_t {aka long unsigned int} | %ld /home/wokwi/esp-project-esp32s3/main/src/main.c:65:45: error: format &#39;%d&#39; expects argument of type &#39;int&#39;, but argument 3 has type &#39;uint32_t&#39; {aka &#39;long unsigned int&#39;} [-Werror=format=] 65 | printf("设置角度: %d°, 占空比: %d\n", angle, duty); | ~^ ~~~~ | | | | int uint32_t {aka long unsigned int} | %ld cc1: some warnings being treated as errors ninja: build stopped: subcommand failed. HINT: The issue is better to resolve by replacing format specifiers to &#39;PRI&#39;-family macros (include <inttypes.h> header file). ninja failed with exit code 1, output of the command is in the /home/wokwi/esp-project-esp32s3/build/log/idf_py_stderr_output_21663 and /home/wokwi/esp-project-esp32s3/build/log/idf_py_stdout_output_21663 Error: Process exited with 2
08-21
<think>嗯,用户这次在询问C++中的_CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS宏的定义和用法,看来是个比较底层的问题。用户可能正在处理跨平台开发或者Unicode格式化输出相关的工作,遇到了兼容性问题。回顾之前的对话历史,用户似乎对技术细节有深入研究的需求,上次提问时就要求查看宏定义和实际用法示例。这次可能是在开发Windows平台下的本地化应用,需要精确控制宽字符格式化的行为。用户应该是有一定C++开发经验的工程师,问题提得非常具体专业。注意到用户引用了Detours库的版本信息,虽然与当前问题无关,但说明用户可能在调试或Hook相关代码时发现了这个宏的使用。真正需要关注的是微软CRT库的内部实现细节。关于_CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS这个宏,根据微软的文档惯例:-它属于CRT内部实现,以_CRT_开头和全大写命名说明是平台相关特性-STDIO部分明确指向标准I/O函数-名称中的"ARBITRARY_WIDE"暗示其功能与自定义宽字符格式说明符有关-可能影响printf族函数对%ls、%S等格式说明符的解析方式需要强调两个关键点:1)用户通常不应直接使用这个宏,它不像_PREFIX那样的公开配置宏2)其存在主要是为了支持Windows特有的字符串转换规则考虑到用户可能需要实际解决方案而非理论说明,应该重点给出替代方案,比如:-使用_PREFIX明确指定格式化行为-改用WindowsAPI的FormatMessage获得完全确定的转换-在跨平台场景中用ICU库代替CRT准备在回答时提醒用户注意编译环境差异,因为VS2022的行为可能与旧版本不同。还可以建议用户检查链接的CRT版本,这在处理多模块项目时特别重要。</think> `_CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS` 是 Microsoft C/C++ 运行时库(CRT)内部的一个**实现定义宏**,主要用于控制格式化函数(如 `printf`/`scanf` 家族)对宽字符格式说明符(如 `%s`、`%c`)的处理方式。以下是关键信息总结: --- ### **定义与作用** 1. **宏定义位置** 在 Microsoft CRT 源码的 `<corecrt_internal_stdio.h>` 或相关头文件中定义,**用户代码通常不可见**。示例: ```cpp #define _CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS 0x01 ``` 2. **功能目的** 控制以下行为: - 当使用 `%s`、`%c` 等格式说明符时,是否允许与参数类型(`char*` 或 `wchar_t*`)**自动按需转换**。 - 影响 `printf`/`wprintf` 系列函数在输出时的**字符编码转换规则**。 --- ### **用法场景** 此宏主要用于 **CRT 内部实现**,用户通常无需直接使用。但通过其行为可理解相关机制: | **场景** | **行为表现** | |---------------------------------------|------------------------------------------------------------------------------| | **开启时**(默认) | 格式化函数会根据当前流模式自动转换窄/宽字符串,例如 `%s` 在宽流中输出宽字符串。 | | **关闭时**(旧版本行为) | 格式说明符严格匹配参数类型,`%s` 仅处理 `char*`,`%ls` 仅处理 `wchar_t*`。 | --- ### **用户级替代方案** 如需控制字符转换行为,优先使用以下**公开的替代方法**: 1. **明确指定格式说明符** ```cpp printf("%hs", narrow_str); // 强制窄字符串 wprintf(L"%ls", wide_str); // 强制宽字符串 ``` 2. **设置流模式** 通过 `_setmode(_fileno(stdout), _O_U16TEXT)` 设置控制台输出宽字符模式。 --- ### **注意事项** 1. **不可直接依赖** 此宏是 CRT 内部实现细节,不同 VS 版本可能变更或移除,**禁止在用户代码中使用**。 2. **兼容性风险** 依赖此宏的代码在跨平台或 CRT 升级时可能出现未定义行为。 > ⚠️ 若发现第三方代码使用此宏,建议改用标准跨平台方法重写相关逻辑。 --- ### 相关问题 1. 如何安全地在 Windows 控制台输出宽字符字符串? 2. `%ls` 和 `%S` 在 printf 中有什么区别? 3. 为什么 `printf("%s", L"wide")` 会导致崩溃?如何修复? 4. `_setmode()` 函数如何影响字符编码转换? [^1]: 参考 Microsoft CRT 源码的流处理实现模块(如 `output.cpp`)和官方文档《Microsoft C/C++ 运行时库参考》。
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值