Skip to content

Commit dce4afd

Browse files
committed
Make local-assigned-but-not-used annotation applicable to all compilers
1 parent 0d7a943 commit dce4afd

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

jbmc/src/java_bytecode/java_bytecode_parser.cpp

+6-10
Original file line numberDiff line numberDiff line change
@@ -460,18 +460,14 @@ bool java_bytecode_parsert::parse()
460460
#define ACC_ANNOTATION 0x2000
461461
#define ACC_ENUM 0x4000
462462

463-
#ifdef _MSC_VER
464-
#define UNUSED
465-
#else
466-
#define UNUSED __attribute__((unused))
467-
#endif
463+
#define UNUSED_u2(x) { const u2 x = read_u2(); (void)x; } (void)0
468464

469465
void java_bytecode_parsert::rClassFile()
470466
{
471467
parse_tree.loading_successful=false;
472468

473469
u4 magic=read_u4();
474-
u2 UNUSED minor_version=read_u2();
470+
UNUSED_u2(minor_version);
475471
u2 major_version=read_u2();
476472

477473
if(magic!=0xCAFEBABE)
@@ -1180,8 +1176,8 @@ void java_bytecode_parsert::rmethod_attribute(methodt &method)
11801176

11811177
if(attribute_name=="Code")
11821178
{
1183-
u2 UNUSED max_stack=read_u2();
1184-
u2 UNUSED max_locals=read_u2();
1179+
UNUSED_u2(max_stack);
1180+
UNUSED_u2(max_locals);
11851181

11861182
rbytecode(method.instructions);
11871183

@@ -1528,8 +1524,8 @@ void java_bytecode_parsert::relement_value_pair(
15281524
{
15291525
case 'e':
15301526
{
1531-
UNUSED u2 type_name_index=read_u2();
1532-
UNUSED u2 const_name_index=read_u2();
1527+
UNUSED_u2(type_name_index);
1528+
UNUSED_u2(const_name_index);
15331529
// todo: enum
15341530
}
15351531
break;

0 commit comments

Comments
 (0)