mirror of
				https://github.com/netwide-assembler/nasm.git
				synced 2025-10-10 00:25:06 -04:00 
			
		
		
		
	Make the LOCK and HLE warnings suppressable.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
This commit is contained in:
		| @@ -818,14 +818,14 @@ static void bad_hle_warn(const insn * ins, uint8_t hleok) | |||||||
|  |  | ||||||
|     case w_lock: |     case w_lock: | ||||||
|         if (ins->prefixes[PPS_LOCK] != P_LOCK) { |         if (ins->prefixes[PPS_LOCK] != P_LOCK) { | ||||||
|             errfunc(ERR_WARNING | ERR_PASS2, |             errfunc(ERR_WARNING | ERR_WARN_HLE | ERR_PASS2, | ||||||
|                     "%s with this instruction requires lock", |                     "%s with this instruction requires lock", | ||||||
|                     prefix_name(rep_pfx)); |                     prefix_name(rep_pfx)); | ||||||
|         } |         } | ||||||
|         break; |         break; | ||||||
|  |  | ||||||
|     case w_inval: |     case w_inval: | ||||||
|         errfunc(ERR_WARNING | ERR_PASS2, |         errfunc(ERR_WARNING | ERR_WARN_HLE | ERR_PASS2, | ||||||
|                 "%s invalid with this instruction", |                 "%s invalid with this instruction", | ||||||
|                 prefix_name(rep_pfx)); |                 prefix_name(rep_pfx)); | ||||||
|         break; |         break; | ||||||
| @@ -1254,7 +1254,7 @@ static int64_t calcsize(int32_t segment, int64_t offset, int bits, | |||||||
|  |  | ||||||
|     if (has_prefix(ins, PPS_LOCK, P_LOCK) && lockcheck && |     if (has_prefix(ins, PPS_LOCK, P_LOCK) && lockcheck && | ||||||
|         (!(temp->flags & IF_LOCK) || !is_class(MEMORY, ins->oprs[0].type))) { |         (!(temp->flags & IF_LOCK) || !is_class(MEMORY, ins->oprs[0].type))) { | ||||||
|         errfunc(ERR_WARNING | ERR_PASS2, |         errfunc(ERR_WARNING | ERR_WARN_LOCK | ERR_PASS2 , | ||||||
|                 "instruction is not lockable"); |                 "instruction is not lockable"); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -948,6 +948,13 @@ Enabled by default. | |||||||
| \b \i\c{user} controls \c{%warning} directives (see \k{pperror}). | \b \i\c{user} controls \c{%warning} directives (see \k{pperror}). | ||||||
| Enabled by default. | Enabled by default. | ||||||
|  |  | ||||||
|  | \b \i\c{lock} warns about \c{LOCK} prefixes on unlockable instructions. | ||||||
|  | Enabled by default. | ||||||
|  |  | ||||||
|  | \b \i\c{hle} warns about invalid use of the HLE \c{XACQUIRE} or \c{XRELEASE} | ||||||
|  | prefixes. | ||||||
|  | Enabled by default. | ||||||
|  |  | ||||||
| \b \i\c{error} causes warnings to be treated as errors.  Disabled by | \b \i\c{error} causes warnings to be treated as errors.  Disabled by | ||||||
| default. | default. | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										4
									
								
								nasm.c
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								nasm.c
									
									
									
									
									
								
							| @@ -1,6 +1,6 @@ | |||||||
| /* ----------------------------------------------------------------------- * | /* ----------------------------------------------------------------------- * | ||||||
|  * |  * | ||||||
|  *   Copyright 1996-2011 The NASM Authors - All Rights Reserved |  *   Copyright 1996-2012 The NASM Authors - All Rights Reserved | ||||||
|  *   See the file AUTHORS included with the NASM distribution for |  *   See the file AUTHORS included with the NASM distribution for | ||||||
|  *   the specific copyright holders. |  *   the specific copyright holders. | ||||||
|  * |  * | ||||||
| @@ -161,6 +161,8 @@ static const struct warning { | |||||||
|     {"float-underflow", "floating point underflow", false}, |     {"float-underflow", "floating point underflow", false}, | ||||||
|     {"float-toolong", "too many digits in floating-point number", true}, |     {"float-toolong", "too many digits in floating-point number", true}, | ||||||
|     {"user", "%warning directives", true}, |     {"user", "%warning directives", true}, | ||||||
|  |     {"lock", "lock prefix on unlockable instructions", true}, | ||||||
|  |     {"hle", "invalid hle prefixes", true}, | ||||||
| }; | }; | ||||||
|  |  | ||||||
| /* | /* | ||||||
|   | |||||||
| @@ -132,7 +132,9 @@ void nasm_set_verror(vefunc); | |||||||
| #define ERR_WARN_FL_UNDERFLOW   WARN( 9) /* FP underflow */ | #define ERR_WARN_FL_UNDERFLOW   WARN( 9) /* FP underflow */ | ||||||
| #define ERR_WARN_FL_TOOLONG     WARN(10) /* FP too many digits */ | #define ERR_WARN_FL_TOOLONG     WARN(10) /* FP too many digits */ | ||||||
| #define ERR_WARN_USER           WARN(11) /* %warning directives */ | #define ERR_WARN_USER           WARN(11) /* %warning directives */ | ||||||
| #define ERR_WARN_MAX            11       /* the highest numbered one */ | #define ERR_WARN_LOCK		WARN(12) /* bad LOCK prefixes */ | ||||||
|  | #define ERR_WARN_HLE		WARN(13) /* bad HLE prefixes */ | ||||||
|  | #define ERR_WARN_MAX            13       /* the highest numbered one */ | ||||||
|  |  | ||||||
| /* | /* | ||||||
|  * Wrappers around malloc, realloc and free. nasm_malloc will |  * Wrappers around malloc, realloc and free. nasm_malloc will | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user