From 049ecc0ab7975f73d413c8c15d8f7b2d05ea14bc Mon Sep 17 00:00:00 2001 From: Ionel-Cristinel ANICHITEI Date: Mon, 27 Jul 2020 16:51:16 +0300 Subject: [PATCH] Don't use reserved identifiers for include guards This fixes #5 --- bddisasm/include/instructions.h | 4 ++-- bddisasm/include/mnemonics.h | 4 ++-- bddisasm/include/nd_crt.h | 6 +++--- bddisasm/include/prefixes.h | 6 +++--- bddisasm/include/table_evex.h | 4 ++-- bddisasm/include/table_root.h | 4 ++-- bddisasm/include/table_vex.h | 4 ++-- bddisasm/include/table_xop.h | 4 ++-- bddisasm/include/tabledefs.h | 6 +++--- inc/bddisasm.h | 6 +++--- inc/bdshemu/bdshemu.h | 6 +++--- inc/constants.h | 4 ++-- inc/cpuidflags.h | 6 +++--- inc/disasmstatus.h | 4 ++-- inc/disasmtypes.h | 4 ++-- inc/registers.h | 4 ++-- inc/version.h | 6 +++--- isagenerator/generate_tables.py | 34 ++++++++++++++++----------------- 18 files changed, 58 insertions(+), 58 deletions(-) diff --git a/bddisasm/include/instructions.h b/bddisasm/include/instructions.h index 263fa83..fa7440d 100644 --- a/bddisasm/include/instructions.h +++ b/bddisasm/include/instructions.h @@ -2,8 +2,8 @@ // This file was auto-generated by generate_tables.py from defs.dat. DO NOT MODIFY! // -#ifndef _INSTRUCTIONS_H_ -#define _INSTRUCTIONS_H_ +#ifndef INSTRUCTIONS_H +#define INSTRUCTIONS_H const ND_INSTRUCTION gInstructions[2557] = { diff --git a/bddisasm/include/mnemonics.h b/bddisasm/include/mnemonics.h index b300927..d13028d 100644 --- a/bddisasm/include/mnemonics.h +++ b/bddisasm/include/mnemonics.h @@ -1,5 +1,5 @@ -#ifndef _MNEMONICS_H_ -#define _MNEMONICS_H_ +#ifndef MNEMONICS_H +#define MNEMONICS_H const char *gMnemonics[1567] = { diff --git a/bddisasm/include/nd_crt.h b/bddisasm/include/nd_crt.h index a0e1c1b..745555d 100644 --- a/bddisasm/include/nd_crt.h +++ b/bddisasm/include/nd_crt.h @@ -2,8 +2,8 @@ * Copyright (c) 2020 Bitdefender * SPDX-License-Identifier: Apache-2.0 */ -#ifndef _ND_CRT_H_ -#define _ND_CRT_H_ +#ifndef ND_CRT_H +#define ND_CRT_H #include "../../inc/disasmtypes.h" @@ -87,4 +87,4 @@ nd_strcat_s( const char *src ); -#endif // _ND_CRT_H_ +#endif // ND_CRT_H diff --git a/bddisasm/include/prefixes.h b/bddisasm/include/prefixes.h index 240366b..60f5efb 100644 --- a/bddisasm/include/prefixes.h +++ b/bddisasm/include/prefixes.h @@ -2,8 +2,8 @@ * Copyright (c) 2020 Bitdefender * SPDX-License-Identifier: Apache-2.0 */ -#ifndef _PREFIXES_H_ -#define _PREFIXES_H_ +#ifndef PREFIXES_H +#define PREFIXES_H #define ND_PREF_CODE_NONE 0 #define ND_PREF_CODE_STANDARD 1 @@ -31,4 +31,4 @@ static const uint8_t gPrefixesMap[256] = 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // F }; -#endif // _PREFIXES_H_ +#endif // PREFIXES_H diff --git a/bddisasm/include/table_evex.h b/bddisasm/include/table_evex.h index 50007f6..024099f 100644 --- a/bddisasm/include/table_evex.h +++ b/bddisasm/include/table_evex.h @@ -1,5 +1,5 @@ -#ifndef _TABLE_EVEX_H_ -#define _TABLE_EVEX_H_ +#ifndef TABLE_EVEX_H +#define TABLE_EVEX_H const ND_TABLE_INSTRUCTION gEvexTable_root_02_9a_03_mem_02_00_leaf = { diff --git a/bddisasm/include/table_root.h b/bddisasm/include/table_root.h index d5f00c1..22d28ff 100644 --- a/bddisasm/include/table_root.h +++ b/bddisasm/include/table_root.h @@ -1,5 +1,5 @@ -#ifndef _TABLE_ROOT_H_ -#define _TABLE_ROOT_H_ +#ifndef TABLE_ROOT_H +#define TABLE_ROOT_H const ND_TABLE_INSTRUCTION gRootTable_root_37_leaf = { diff --git a/bddisasm/include/table_vex.h b/bddisasm/include/table_vex.h index 0784764..6f3e281 100644 --- a/bddisasm/include/table_vex.h +++ b/bddisasm/include/table_vex.h @@ -1,5 +1,5 @@ -#ifndef _TABLE_VEX_H_ -#define _TABLE_VEX_H_ +#ifndef TABLE_VEX_H +#define TABLE_VEX_H const ND_TABLE_INSTRUCTION gVexTable_root_02_f2_00_00_leaf = { diff --git a/bddisasm/include/table_xop.h b/bddisasm/include/table_xop.h index 027565b..d3ed805 100644 --- a/bddisasm/include/table_xop.h +++ b/bddisasm/include/table_xop.h @@ -1,5 +1,5 @@ -#ifndef _TABLE_XOP_H_ -#define _TABLE_XOP_H_ +#ifndef TABLE_XOP_H +#define TABLE_XOP_H const ND_TABLE_INSTRUCTION gXopTable_root_0a_10_leaf = { diff --git a/bddisasm/include/tabledefs.h b/bddisasm/include/tabledefs.h index c1918b6..49f40cf 100644 --- a/bddisasm/include/tabledefs.h +++ b/bddisasm/include/tabledefs.h @@ -2,8 +2,8 @@ * Copyright (c) 2020 Bitdefender * SPDX-License-Identifier: Apache-2.0 */ -#ifndef _TABLEDEFS_H_ -#define _TABLEDEFS_H_ +#ifndef TABLEDEFS_H +#define TABLEDEFS_H // // Types of tables. @@ -494,4 +494,4 @@ typedef enum _ND_OPERAND_TYPE_SPEC #include "table_vex.h" #include "table_evex.h" -#endif // _TABLEDEFS_H_ +#endif // TABLEDEFS_H diff --git a/inc/bddisasm.h b/inc/bddisasm.h index c694b27..40f00f9 100644 --- a/inc/bddisasm.h +++ b/inc/bddisasm.h @@ -2,8 +2,8 @@ * Copyright (c) 2020 Bitdefender * SPDX-License-Identifier: Apache-2.0 */ -#ifndef _BDDISASM_H_ -#define _BDDISASM_H_ +#ifndef BDDISASM_H +#define BDDISASM_H #include "disasmstatus.h" #include "registers.h" @@ -1470,4 +1470,4 @@ NdGetFullAccessMap( #pragma warning(pop) #endif -#endif // _BDDISASM_H_ +#endif // BDDISASM_H diff --git a/inc/bdshemu/bdshemu.h b/inc/bdshemu/bdshemu.h index 06677e7..b6788be 100644 --- a/inc/bdshemu/bdshemu.h +++ b/inc/bdshemu/bdshemu.h @@ -2,8 +2,8 @@ * Copyright (c) 2020 Bitdefender * SPDX-License-Identifier: Apache-2.0 */ -#ifndef _BDSHEMU_H_ -#define _BDSHEMU_H_ +#ifndef BDSHEMU_H +#define BDSHEMU_H #include "bddisasm.h" @@ -276,4 +276,4 @@ ShemuEmulate( ); -#endif // !_BDSHEMU_H_ +#endif // BDSHEMU_H diff --git a/inc/constants.h b/inc/constants.h index b414fc6..18d5c72 100644 --- a/inc/constants.h +++ b/inc/constants.h @@ -2,8 +2,8 @@ // This file was auto-generated by generate_tables.py from defs.dat. DO NOT MODIFY! // -#ifndef _CONSTANTS_H_ -#define _CONSTANTS_H_ +#ifndef CONSTANTS_H +#define CONSTANTS_H typedef enum _ND_INS_CLASS diff --git a/inc/cpuidflags.h b/inc/cpuidflags.h index 03d52da..3b7aea7 100644 --- a/inc/cpuidflags.h +++ b/inc/cpuidflags.h @@ -1,5 +1,5 @@ -#ifndef _CPUID_FLAGS_H_ -#define _CPUID_FLAGS_H_ +#ifndef CPUID_FLAGS_H +#define CPUID_FLAGS_H #define ND_CFF_NO_LEAF 0xFFFFFFFF #define ND_CFF_NO_SUBLEAF 0x00FFFFFF @@ -105,4 +105,4 @@ #define ND_CFF_MCOMMIT ND_CFF(0x80000008, 0xFFFFFFFF, REG_EBX, 8) #define ND_CFF_SNP ND_CFF(0x8000001F, 0xFFFFFFFF, REG_EAX, 4) -#endif // _CPUID_FLAGS_H_ +#endif // CPUID_FLAGS_H diff --git a/inc/disasmstatus.h b/inc/disasmstatus.h index 330501f..38e45e7 100644 --- a/inc/disasmstatus.h +++ b/inc/disasmstatus.h @@ -2,8 +2,8 @@ * Copyright (c) 2020 Bitdefender * SPDX-License-Identifier: Apache-2.0 */ -#ifndef _DISASMSTATUS_H_ -#define _DISASMSTATUS_H_ +#ifndef DISASMSTATUS_H +#define DISASMSTATUS_H // // Return statuses. diff --git a/inc/disasmtypes.h b/inc/disasmtypes.h index dd90f24..8164e7f 100644 --- a/inc/disasmtypes.h +++ b/inc/disasmtypes.h @@ -2,8 +2,8 @@ * Copyright (c) 2020 Bitdefender * SPDX-License-Identifier: Apache-2.0 */ -#ifndef _DISASM_TYPES_H_ -#define _DISASM_TYPES_H_ +#ifndef DISASM_TYPES_H +#define DISASM_TYPES_H #if defined(KERNEL_MODE) && defined(_MSC_VER) # include diff --git a/inc/registers.h b/inc/registers.h index 91e4be8..6756186 100644 --- a/inc/registers.h +++ b/inc/registers.h @@ -2,8 +2,8 @@ * Copyright (c) 2020 Bitdefender * SPDX-License-Identifier: Apache-2.0 */ -#ifndef _REGISTERS_H_ -#define _REGISTERS_H_ +#ifndef REGISTERS_H +#define REGISTERS_H // // Registers enumerations diff --git a/inc/version.h b/inc/version.h index ecd870f..d33017a 100644 --- a/inc/version.h +++ b/inc/version.h @@ -2,11 +2,11 @@ * Copyright (c) 2020 Bitdefender * SPDX-License-Identifier: Apache-2.0 */ -#ifndef _DISASM_VER_H_ -#define _DISASM_VER_H_ +#ifndef DISASM_VER_H +#define DISASM_VER_H #define DISASM_VERSION_MAJOR 1 #define DISASM_VERSION_MINOR 26 #define DISASM_VERSION_REVISION 3 -#endif // _DISASM_VER_H_ +#endif // DISASM_VER_H diff --git a/isagenerator/generate_tables.py b/isagenerator/generate_tables.py index 9e8f64e..9d089fc 100644 --- a/isagenerator/generate_tables.py +++ b/isagenerator/generate_tables.py @@ -953,8 +953,8 @@ def generate_translations2(instructions): #dump_hash_tree2(hash_st) print('Writing the table_root.h file...') f = open(r'../bddisasm/include/table_root.h', 'wt') - f.write("#ifndef _TABLE_ROOT_H_\n") - f.write("#define _TABLE_ROOT_H_\n\n") + f.write("#ifndef TABLE_ROOT_H\n") + f.write("#define TABLE_ROOT_H\n\n") dump_translation_tree_c(hash_st, 'gRootTable', f) f.write("\n#endif\n\n") f.close() @@ -962,8 +962,8 @@ def generate_translations2(instructions): #dump_hash_tree2(hash_vex) print('Writing the table_vex.h file...') f = open(r'../bddisasm/include/table_vex.h', 'wt') - f.write("#ifndef _TABLE_VEX_H_\n") - f.write("#define _TABLE_VEX_H_\n\n") + f.write("#ifndef TABLE_VEX_H\n") + f.write("#define TABLE_VEX_H\n\n") dump_translation_tree_c(hash_vex, 'gVexTable', f) f.write("\n#endif\n\n") f.close() @@ -971,8 +971,8 @@ def generate_translations2(instructions): #dump_hash_tree2(hash_xop) print('Writing the table_xop.h file...') f = open(r'../bddisasm/include/table_xop.h', 'wt') - f.write("#ifndef _TABLE_XOP_H_\n") - f.write("#define _TABLE_XOP_H_\n\n") + f.write("#ifndef TABLE_XOP_H\n") + f.write("#define TABLE_XOP_H\n\n") dump_translation_tree_c(hash_xop, 'gXopTable', f) f.write("\n#endif\n\n") f.close() @@ -980,8 +980,8 @@ def generate_translations2(instructions): #dump_hash_tree2(hash_evex) print('Writing the table_evex.h file...') f = open(r'../bddisasm/include/table_evex.h', 'wt') - f.write("#ifndef _TABLE_EVEX_H_\n") - f.write("#define _TABLE_EVEX_H_\n\n") + f.write("#ifndef TABLE_EVEX_H\n") + f.write("#define TABLE_EVEX_H\n\n") dump_translation_tree_c(hash_evex, 'gEvexTable', f) f.write("\n#endif\n\n") f.close() @@ -1020,8 +1020,8 @@ def generate_constants2(instructions): def dump_mnemonics(mnemonics, prefixes, fname): f = open(fname, 'wt') - f.write('#ifndef _MNEMONICS_H_\n') - f.write('#define _MNEMONICS_H_\n') + f.write('#ifndef MNEMONICS_H\n') + f.write('#define MNEMONICS_H\n') f.write('\n') f.write('const char *gMnemonics[%d] = \n' % len(mnemonics)) f.write('{\n') @@ -1058,8 +1058,8 @@ def dump_constants(constants, prefixes, constants_sets, constants_types, fname): f.write('//\n') f.write('// This file was auto-generated by generate_tables.py from defs.dat. DO NOT MODIFY!\n') f.write('//\n\n') - f.write('#ifndef _CONSTANTS_H_\n') - f.write('#define _CONSTANTS_H_\n\n') + f.write('#ifndef CONSTANTS_H\n') + f.write('#define CONSTANTS_H\n\n') f.write('\n') f.write('typedef enum _ND_INS_CLASS\n') f.write('{\n') @@ -1106,8 +1106,8 @@ def generate_master_table(instructions, fname): f.write('//\n') f.write('// This file was auto-generated by generate_tables.py from defs.dat. DO NOT MODIFY!\n') f.write('//\n\n') - f.write('#ifndef _INSTRUCTIONS_H_\n') - f.write('#define _INSTRUCTIONS_H_\n') + f.write('#ifndef INSTRUCTIONS_H\n') + f.write('#define INSTRUCTIONS_H\n') f.write('\n') flags = [] f.write('const ND_INSTRUCTION gInstructions[%s] = \n' % len(instructions)) @@ -1184,8 +1184,8 @@ def dump_translation_tree_c(t, hname, f): def generate_features(features, fname): f = open(fname, 'wt') - f.write('#ifndef _CPUID_FLAGS_H_\n') - f.write('#define _CPUID_FLAGS_H_\n') + f.write('#ifndef CPUID_FLAGS_H\n') + f.write('#define CPUID_FLAGS_H\n') f.write('\n') f.write('#define ND_CFF_NO_LEAF 0xFFFFFFFF\n') @@ -1200,7 +1200,7 @@ def generate_features(features, fname): f.write('\n') - f.write('#endif // _CPUID_FLAGS_H_\n') + f.write('#endif // CPUID_FLAGS_H\n') # # =============================================================================