mirror of
				https://github.com/tiagovignatti/intel-gpu-tools.git
				synced 2025-11-04 03:58:27 +00:00 
			
		
		
		
	lib/igt_core: use print("%s", #expr) instead of print(#expr)
If I have a program with the following:
    igt_skip_on(i % 2 == 0);
    igt_skip_on_f(i % 2 == 0, "i:%d\n", i);
    igt_require(i % 2 == 0);
    igt_require_f(i % 2 == 0, "i:%d\n", i);
then I'll get compiler error messages complaining about format
conversions related to the '%' character used in the mod operation. So
put the whole string as a %s argument to avoid interpreting '%' and
any other possible chars.
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
			
			
This commit is contained in:
		
							parent
							
								
									87a5f2d776
								
							
						
					
					
						commit
						a1fce7490c
					
				@ -491,7 +491,7 @@ void igt_exit(void) __attribute__((noreturn));
 | 
			
		||||
 */
 | 
			
		||||
#define igt_require(expr) do { \
 | 
			
		||||
	if (!(expr)) igt_skip_check(#expr , NULL); \
 | 
			
		||||
	else igt_debug("Test requirement passed: "#expr"\n"); \
 | 
			
		||||
	else igt_debug("Test requirement passed: %s\n", #expr); \
 | 
			
		||||
} while (0)
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
@ -506,7 +506,7 @@ void igt_exit(void) __attribute__((noreturn));
 | 
			
		||||
 */
 | 
			
		||||
#define igt_skip_on(expr) do { \
 | 
			
		||||
	if ((expr)) igt_skip_check("!(" #expr ")" , NULL); \
 | 
			
		||||
	else igt_debug("Test requirement passed: !("#expr")\n"); \
 | 
			
		||||
	else igt_debug("Test requirement passed: !(%s)\n", #expr); \
 | 
			
		||||
} while (0)
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
@ -525,7 +525,7 @@ void igt_exit(void) __attribute__((noreturn));
 | 
			
		||||
 */
 | 
			
		||||
#define igt_require_f(expr, f...) do { \
 | 
			
		||||
	if (!(expr)) igt_skip_check(#expr , f); \
 | 
			
		||||
	else igt_debug("Test requirement passed: "#expr"\n"); \
 | 
			
		||||
	else igt_debug("Test requirement passed: %s\n", #expr); \
 | 
			
		||||
} while (0)
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
@ -544,7 +544,7 @@ void igt_exit(void) __attribute__((noreturn));
 | 
			
		||||
 */
 | 
			
		||||
#define igt_skip_on_f(expr, f...) do { \
 | 
			
		||||
	if ((expr)) igt_skip_check("!("#expr")", f); \
 | 
			
		||||
	else igt_debug("Test requirement passed: !("#expr")\n"); \
 | 
			
		||||
	else igt_debug("Test requirement passed: !(%s)\n", #expr); \
 | 
			
		||||
} while (0)
 | 
			
		||||
 | 
			
		||||
/* fork support code */
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user