Skip to content

Commit

Permalink
Don't use reserved identifiers for include guards
Browse files Browse the repository at this point in the history
This fixes #5
  • Loading branch information
ianichitei committed Jul 27, 2020
1 parent 0d5d2a9 commit 049ecc0
Show file tree
Hide file tree
Showing 18 changed files with 58 additions and 58 deletions.
4 changes: 2 additions & 2 deletions bddisasm/include/instructions.h
Original file line number Diff line number Diff line change
Expand Up @@ -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] =
{
Expand Down
4 changes: 2 additions & 2 deletions bddisasm/include/mnemonics.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef _MNEMONICS_H_
#define _MNEMONICS_H_
#ifndef MNEMONICS_H
#define MNEMONICS_H

const char *gMnemonics[1567] =
{
Expand Down
6 changes: 3 additions & 3 deletions bddisasm/include/nd_crt.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -87,4 +87,4 @@ nd_strcat_s(
const char *src
);

#endif // _ND_CRT_H_
#endif // ND_CRT_H
6 changes: 3 additions & 3 deletions bddisasm/include/prefixes.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
4 changes: 2 additions & 2 deletions bddisasm/include/table_evex.h
Original file line number Diff line number Diff line change
@@ -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 =
{
Expand Down
4 changes: 2 additions & 2 deletions bddisasm/include/table_root.h
Original file line number Diff line number Diff line change
@@ -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 =
{
Expand Down
4 changes: 2 additions & 2 deletions bddisasm/include/table_vex.h
Original file line number Diff line number Diff line change
@@ -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 =
{
Expand Down
4 changes: 2 additions & 2 deletions bddisasm/include/table_xop.h
Original file line number Diff line number Diff line change
@@ -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 =
{
Expand Down
6 changes: 3 additions & 3 deletions bddisasm/include/tabledefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -494,4 +494,4 @@ typedef enum _ND_OPERAND_TYPE_SPEC
#include "table_vex.h"
#include "table_evex.h"

#endif // _TABLEDEFS_H_
#endif // TABLEDEFS_H
6 changes: 3 additions & 3 deletions inc/bddisasm.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -1470,4 +1470,4 @@ NdGetFullAccessMap(
#pragma warning(pop)
#endif

#endif // _BDDISASM_H_
#endif // BDDISASM_H
6 changes: 3 additions & 3 deletions inc/bdshemu/bdshemu.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -276,4 +276,4 @@ ShemuEmulate(
);


#endif // !_BDSHEMU_H_
#endif // BDSHEMU_H
4 changes: 2 additions & 2 deletions inc/constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions inc/cpuidflags.h
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
4 changes: 2 additions & 2 deletions inc/disasmstatus.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions inc/disasmtypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <ntddk.h>
Expand Down
4 changes: 2 additions & 2 deletions inc/registers.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions inc/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
34 changes: 17 additions & 17 deletions isagenerator/generate_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -953,35 +953,35 @@ 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()
#print "###########################################################################################################"
#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()
#print "###########################################################################################################"
#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()
#print "###########################################################################################################"
#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()
Expand Down Expand Up @@ -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')
Expand Down Expand Up @@ -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')
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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')
Expand All @@ -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')

#
# =============================================================================
Expand Down

0 comments on commit 049ecc0

Please sign in to comment.