Skip to content

Commit 37e75a0

Browse files
committed
change (void) param methods to jsut () for #437. Make tautological compares clang pragmas.
1 parent efd5882 commit 37e75a0

File tree

1 file changed

+55
-55
lines changed

1 file changed

+55
-55
lines changed

sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/cpp/CppGenerator.java

Lines changed: 55 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ private static void generateGroupClassHeader(
254254
indent + " {\n" +
255255
indent + " return %2$d;\n" +
256256
indent + " }\n\n" +
257-
indent + " std::uint64_t position(void) const\n" +
257+
indent + " std::uint64_t position() const\n" +
258258
indent + " {\n" +
259259
indent + " return *m_positionPtr;\n" +
260260
indent + " }\n\n" +
@@ -266,15 +266,15 @@ private static void generateGroupClassHeader(
266266
indent + " }\n" +
267267
indent + " *m_positionPtr = position;\n" +
268268
indent + " }\n\n" +
269-
indent + " inline std::uint64_t count(void) const\n" +
269+
indent + " inline std::uint64_t count() const\n" +
270270
indent + " {\n" +
271271
indent + " return m_count;\n" +
272272
indent + " }\n\n" +
273-
indent + " inline bool hasNext(void) const\n" +
273+
indent + " inline bool hasNext() const\n" +
274274
indent + " {\n" +
275275
indent + " return m_index + 1 < m_count;\n" +
276276
indent + " }\n\n" +
277-
indent + " inline %3$s &next(void)\n" +
277+
indent + " inline %3$s &next()\n" +
278278
indent + " {\n" +
279279
indent + " m_offset = *m_positionPtr;\n" +
280280
indent + " if (SBE_BOUNDS_CHECK_EXPECT(( (m_offset + m_blockLength) > m_bufferLength ), false))\n" +
@@ -326,7 +326,7 @@ private static CharSequence generateGroupProperty(
326326

327327
sb.append(String.format(
328328
"\n" +
329-
indent + " static SBE_CONSTEXPR std::uint16_t %1$sId(void)\n" +
329+
indent + " static SBE_CONSTEXPR std::uint16_t %1$sId()\n" +
330330
indent + " {\n" +
331331
indent + " return %2$d;\n" +
332332
indent + " }\n\n",
@@ -335,7 +335,7 @@ private static CharSequence generateGroupProperty(
335335

336336
sb.append(String.format(
337337
"\n" +
338-
indent + " inline %1$s &%2$s(void)\n" +
338+
indent + " inline %1$s &%2$s()\n" +
339339
indent + " {\n" +
340340
indent + " m_%2$s.wrapForDecode(m_buffer, m_positionPtr, m_actingVersion, m_bufferLength);\n" +
341341
indent + " return m_%2$s;\n" +
@@ -356,16 +356,16 @@ private static CharSequence generateGroupProperty(
356356
cppTypeForNumInGroup));
357357

358358
sb.append(String.format(
359-
indent + " static SBE_CONSTEXPR std::uint64_t %1$sSinceVersion(void)\n" +
359+
indent + " static SBE_CONSTEXPR std::uint64_t %1$sSinceVersion()\n" +
360360
indent + " {\n" +
361361
indent + " return %2$d;\n" +
362362
indent + " }\n\n" +
363-
indent + " bool %1$sInActingVersion(void)\n" +
363+
indent + " bool %1$sInActingVersion()\n" +
364364
indent + " {\n" +
365-
indent + "#pragma GCC diagnostic push\n" +
366-
indent + "#pragma GCC diagnostic ignored \"-Wtautological-compare\"\n" +
365+
indent + "#pragma clang diagnostic push\n" +
366+
indent + "#pragma clang diagnostic ignored \"-Wtautological-compare\"\n" +
367367
indent + " return m_actingVersion >= %1$sSinceVersion();\n" +
368-
indent + "#pragma GCC diagnostic pop\n" +
368+
indent + "#pragma clang diagnostic pop\n" +
369369
indent + " }\n",
370370
propertyName,
371371
token.version()));
@@ -397,7 +397,7 @@ private CharSequence generateVarData(final String className, final List<Token> t
397397
sb, token, propertyName, characterEncoding, lengthToken, lengthOfLengthField, lengthCppType, indent);
398398

399399
sb.append(String.format(
400-
indent + " const char *%1$s(void)\n" +
400+
indent + " const char *%1$s()\n" +
401401
indent + " {\n" +
402402
"%2$s" +
403403
indent + " const char *fieldPtr = (m_buffer + position() + %3$d);\n" +
@@ -515,18 +515,18 @@ private void generateVarDataDescriptors(
515515
characterEncoding));
516516

517517
sb.append(String.format(
518-
indent + " static SBE_CONSTEXPR std::uint64_t %1$sSinceVersion(void)\n" +
518+
indent + " static SBE_CONSTEXPR std::uint64_t %1$sSinceVersion()\n" +
519519
indent + " {\n" +
520520
indent + " return %2$d;\n" +
521521
indent + " }\n\n" +
522-
indent + " bool %1$sInActingVersion(void)\n" +
522+
indent + " bool %1$sInActingVersion()\n" +
523523
indent + " {\n" +
524-
indent + "#pragma GCC diagnostic push\n" +
525-
indent + "#pragma GCC diagnostic ignored \"-Wtautological-compare\"\n" +
524+
indent + "#pragma clang diagnostic push\n" +
525+
indent + "#pragma clang diagnostic ignored \"-Wtautological-compare\"\n" +
526526
indent + " return m_actingVersion >= %1$sSinceVersion();\n" +
527-
indent + "#pragma GCC diagnostic pop\n" +
527+
indent + "#pragma clang diagnostic pop\n" +
528528
indent + " }\n\n" +
529-
indent + " static SBE_CONSTEXPR std::uint16_t %1$sId(void)\n" +
529+
indent + " static SBE_CONSTEXPR std::uint16_t %1$sId()\n" +
530530
indent + " {\n" +
531531
indent + " return %3$d;\n" +
532532
indent + " }\n\n",
@@ -545,7 +545,7 @@ private void generateVarDataDescriptors(
545545

546546
sb.append(String.format(
547547
"\n" +
548-
indent + " %4$s %1$sLength(void) const\n" +
548+
indent + " %4$s %1$sLength() const\n" +
549549
indent + " {\n" +
550550
"%2$s" +
551551
indent + " return %3$s(*((%4$s *)(m_buffer + position())));\n" +
@@ -568,7 +568,7 @@ private void generateChoiceSet(final List<Token> tokens) throws IOException
568568

569569
out.append(String.format(
570570
"\n" +
571-
" %1$s &clear(void)\n" +
571+
" %1$s &clear()\n" +
572572
" {\n" +
573573
" *((%2$s *)(m_buffer + m_offset)) = 0;\n" +
574574
" return *this;\n" +
@@ -653,7 +653,7 @@ private CharSequence generateChoices(final String bitsetClassName, final List<To
653653

654654
sb.append(String.format(
655655
"\n" +
656-
" bool %1$s(void) const\n" +
656+
" bool %1$s() const\n" +
657657
" {\n" +
658658
"%2$s" +
659659
" return %3$s(*((%4$s *)(m_buffer + m_offset))) & (0x1L << %5$s);\n" +
@@ -981,7 +981,7 @@ private CharSequence generatePrimitiveFieldMetaData(
981981

982982
sb.append(String.format(
983983
"\n" +
984-
indent + " static SBE_CONSTEXPR std::size_t %1$sEncodingLength(void)\n" +
984+
indent + " static SBE_CONSTEXPR std::size_t %1$sEncodingLength()\n" +
985985
indent + " {\n" +
986986
indent + " return %2$d;\n" +
987987
indent + " }\n",
@@ -1000,7 +1000,7 @@ private CharSequence generateSingleValueProperty(
10001000

10011001
sb.append(String.format(
10021002
"\n" +
1003-
indent + " %1$s %2$s(void) const\n" +
1003+
indent + " %1$s %2$s() const\n" +
10041004
indent + " {\n" +
10051005
"%3$s" +
10061006
indent + " return %4$s(*((%1$s *)(m_buffer + m_offset + %5$d)));\n" +
@@ -1036,15 +1036,15 @@ private CharSequence generateArrayProperty(
10361036

10371037
sb.append(String.format(
10381038
"\n" +
1039-
indent + " static SBE_CONSTEXPR std::uint64_t %1$sLength(void)\n" +
1039+
indent + " static SBE_CONSTEXPR std::uint64_t %1$sLength()\n" +
10401040
indent + " {\n" +
10411041
indent + " return %2$d;\n" +
10421042
indent + " }\n\n",
10431043
propertyName,
10441044
token.arrayLength()));
10451045

10461046
sb.append(String.format(
1047-
indent + " const char *%1$s(void) const\n" +
1047+
indent + " const char *%1$s() const\n" +
10481048
indent + " {\n" +
10491049
"%2$s" +
10501050
indent + " return (m_buffer + m_offset + %3$d);\n" +
@@ -1150,7 +1150,7 @@ private CharSequence generateConstPropertyMethods(
11501150
{
11511151
return String.format(
11521152
"\n" +
1153-
indent + " static SBE_CONSTEXPR %1$s %2$s(void)\n" +
1153+
indent + " static SBE_CONSTEXPR %1$s %2$s()\n" +
11541154
indent + " {\n" +
11551155
indent + " return %3$s;\n" +
11561156
indent + " }\n",
@@ -1175,15 +1175,15 @@ private CharSequence generateConstPropertyMethods(
11751175

11761176
sb.append(String.format(
11771177
"\n" +
1178-
indent + " static SBE_CONSTEXPR std::uint64_t %1$sLength(void)\n" +
1178+
indent + " static SBE_CONSTEXPR std::uint64_t %1$sLength()\n" +
11791179
indent + " {\n" +
11801180
indent + " return %2$d;\n" +
11811181
indent + " }\n\n",
11821182
propertyName,
11831183
constantValue.length));
11841184

11851185
sb.append(String.format(
1186-
indent + " const char *%1$s(void) const\n" +
1186+
indent + " const char *%1$s() const\n" +
11871187
indent + " {\n" +
11881188
indent + " static sbe_uint8_t %1$sValues[] = {%2$s};\n\n" +
11891189
indent + " return (const char *)%1$sValues;\n" +
@@ -1238,7 +1238,7 @@ private static CharSequence generateFixedFlyweightCode(final String className, f
12381238
" m_actingVersion = actingVersion;\n" +
12391239
" }\n\n" +
12401240
"public:\n" +
1241-
" %1$s(void) : m_buffer(nullptr), m_offset(0) {}\n\n" +
1241+
" %1$s() : m_buffer(nullptr), m_offset(0) {}\n\n" +
12421242
" %1$s(char *buffer, const std::uint64_t bufferLength, const std::uint64_t actingVersion)\n" +
12431243
" {\n" +
12441244
" reset(buffer, 0, bufferLength, actingVersion);\n" +
@@ -1249,15 +1249,15 @@ private static CharSequence generateFixedFlyweightCode(final String className, f
12491249
" reset(buffer, offset, bufferLength, actingVersion);\n" +
12501250
" return *this;\n" +
12511251
" }\n\n" +
1252-
" static SBE_CONSTEXPR std::uint64_t encodedLength(void)\n" +
1252+
" static SBE_CONSTEXPR std::uint64_t encodedLength()\n" +
12531253
" {\n" +
12541254
" return %2$s;\n" +
12551255
" }\n\n" +
1256-
" std::uint64_t offset(void) const\n" +
1256+
" std::uint64_t offset() const\n" +
12571257
" {\n" +
12581258
" return m_offset;\n" +
12591259
" }\n\n" +
1260-
" char *buffer(void)\n" +
1260+
" char *buffer()\n" +
12611261
" {\n" +
12621262
" return m_buffer;\n" +
12631263
" }\n\n",
@@ -1268,7 +1268,7 @@ private static CharSequence generateFixedFlyweightCode(final String className, f
12681268
private static CharSequence generateConstructorsAndOperators(final String className)
12691269
{
12701270
return String.format(
1271-
" %1$s(void) : m_buffer(nullptr), m_bufferLength(0), m_offset(0) {}\n\n" +
1271+
" %1$s() : m_buffer(nullptr), m_bufferLength(0), m_offset(0) {}\n\n" +
12721272
" %1$s(char *buffer, const std::uint64_t bufferLength)\n" +
12731273
" {\n" +
12741274
" reset(buffer, 0, bufferLength, sbeBlockLength(), sbeSchemaVersion());\n" +
@@ -1312,27 +1312,27 @@ private CharSequence generateMessageFlyweightCode(final String className, final
13121312
" }\n\n" +
13131313
"public:\n\n" +
13141314
"%11$s" +
1315-
" static SBE_CONSTEXPR %1$s sbeBlockLength(void)\n" +
1315+
" static SBE_CONSTEXPR %1$s sbeBlockLength()\n" +
13161316
" {\n" +
13171317
" return %2$s;\n" +
13181318
" }\n\n" +
1319-
" static SBE_CONSTEXPR %3$s sbeTemplateId(void)\n" +
1319+
" static SBE_CONSTEXPR %3$s sbeTemplateId()\n" +
13201320
" {\n" +
13211321
" return %4$s;\n" +
13221322
" }\n\n" +
1323-
" static SBE_CONSTEXPR %5$s sbeSchemaId(void)\n" +
1323+
" static SBE_CONSTEXPR %5$s sbeSchemaId()\n" +
13241324
" {\n" +
13251325
" return %6$s;\n" +
13261326
" }\n\n" +
1327-
" static SBE_CONSTEXPR %7$s sbeSchemaVersion(void)\n" +
1327+
" static SBE_CONSTEXPR %7$s sbeSchemaVersion()\n" +
13281328
" {\n" +
13291329
" return %8$s;\n" +
13301330
" }\n\n" +
1331-
" static SBE_CONSTEXPR const char * sbeSemanticType(void)\n" +
1331+
" static SBE_CONSTEXPR const char * sbeSemanticType()\n" +
13321332
" {\n" +
13331333
" return \"%9$s\";\n" +
13341334
" }\n\n" +
1335-
" std::uint64_t offset(void) const\n" +
1335+
" std::uint64_t offset() const\n" +
13361336
" {\n" +
13371337
" return m_offset;\n" +
13381338
" }\n\n" +
@@ -1348,7 +1348,7 @@ private CharSequence generateMessageFlyweightCode(final String className, final
13481348
" reset(buffer, offset, bufferLength, actingBlockLength, actingVersion);\n" +
13491349
" return *this;\n" +
13501350
" }\n\n" +
1351-
" std::uint64_t position(void) const\n" +
1351+
" std::uint64_t position() const\n" +
13521352
" {\n" +
13531353
" return m_position;\n" +
13541354
" }\n\n" +
@@ -1360,15 +1360,15 @@ private CharSequence generateMessageFlyweightCode(final String className, final
13601360
" }\n" +
13611361
" m_position = position;\n" +
13621362
" }\n\n" +
1363-
" std::uint64_t encodedLength(void) const\n" +
1363+
" std::uint64_t encodedLength() const\n" +
13641364
" {\n" +
13651365
" return position() - m_offset;\n" +
13661366
" }\n\n" +
1367-
" char *buffer(void)\n" +
1367+
" char *buffer()\n" +
13681368
" {\n" +
13691369
" return m_buffer;\n" +
13701370
" }\n\n" +
1371-
" std::uint64_t actingVersion(void) const\n" +
1371+
" std::uint64_t actingVersion() const\n" +
13721372
" {\n" +
13731373
" return m_actingVersion;\n" +
13741374
" }\n",
@@ -1399,30 +1399,30 @@ private CharSequence generateFields(final String containingClassName, final List
13991399

14001400
sb.append(String.format(
14011401
"\n" +
1402-
indent + " static SBE_CONSTEXPR std::uint16_t %1$sId(void)\n" +
1402+
indent + " static SBE_CONSTEXPR std::uint16_t %1$sId()\n" +
14031403
indent + " {\n" +
14041404
indent + " return %2$d;\n" +
14051405
indent + " }\n\n",
14061406
propertyName,
14071407
signalToken.id()));
14081408

14091409
sb.append(String.format(
1410-
indent + " static SBE_CONSTEXPR std::uint64_t %1$sSinceVersion(void)\n" +
1410+
indent + " static SBE_CONSTEXPR std::uint64_t %1$sSinceVersion()\n" +
14111411
indent + " {\n" +
14121412
indent + " return %2$d;\n" +
14131413
indent + " }\n\n" +
1414-
indent + " bool %1$sInActingVersion(void)\n" +
1414+
indent + " bool %1$sInActingVersion()\n" +
14151415
indent + " {\n" +
1416-
indent + "#pragma GCC diagnostic push\n" +
1417-
indent + "#pragma GCC diagnostic ignored \"-Wtautological-compare\"\n" +
1416+
indent + "#pragma clang diagnostic push\n" +
1417+
indent + "#pragma clang diagnostic ignored \"-Wtautological-compare\"\n" +
14181418
indent + " return m_actingVersion >= %1$sSinceVersion();\n" +
1419-
indent + "#pragma GCC diagnostic pop\n" +
1419+
indent + "#pragma clang diagnostic pop\n" +
14201420
indent + " }\n\n",
14211421
propertyName,
14221422
signalToken.version()));
14231423

14241424
sb.append(String.format(
1425-
indent + " static SBE_CONSTEXPR std::size_t %1$sEncodingOffset(void)\n" +
1425+
indent + " static SBE_CONSTEXPR std::size_t %1$sEncodingOffset()\n" +
14261426
indent + " {\n" +
14271427
indent + " return %2$d;\n" +
14281428
indent + " }\n\n",
@@ -1521,7 +1521,7 @@ private CharSequence generateEnumProperty(
15211521

15221522
sb.append(String.format(
15231523
"\n" +
1524-
indent + " %1$s::Value %2$s(void) const\n" +
1524+
indent + " %1$s::Value %2$s() const\n" +
15251525
indent + " {\n" +
15261526
"%3$s" +
15271527
indent + " return %1$s::Value::%4$s;\n" +
@@ -1535,7 +1535,7 @@ private CharSequence generateEnumProperty(
15351535
{
15361536
sb.append(String.format(
15371537
"\n" +
1538-
indent + " %1$s::Value %2$s(void) const\n" +
1538+
indent + " %1$s::Value %2$s() const\n" +
15391539
indent + " {\n" +
15401540
"%3$s" +
15411541
indent + " return %1$s::get(%4$s(*((%5$s *)(m_buffer + m_offset + %6$d))));\n" +
@@ -1561,7 +1561,7 @@ private CharSequence generateEnumProperty(
15611561
formatByteOrderEncoding(token.encoding().byteOrder(), token.encoding().primitiveType())));
15621562

15631563
sb.append(String.format(
1564-
indent + " static SBE_CONSTEXPR std::size_t %1$sEncodingLength(void)\n" +
1564+
indent + " static SBE_CONSTEXPR std::size_t %1$sEncodingLength()\n" +
15651565
indent + " {\n" +
15661566
indent + " return %2$d;\n" +
15671567
indent + " }\n",
@@ -1600,7 +1600,7 @@ private static Object generateBitsetProperty(final String propertyName, final To
16001600

16011601
sb.append(String.format(
16021602
"\n" +
1603-
indent + " static SBE_CONSTEXPR std::size_t %1$sEncodingLength(void)\n" +
1603+
indent + " static SBE_CONSTEXPR std::size_t %1$sEncodingLength()\n" +
16041604
indent + " {\n" +
16051605
indent + " return %2$d;\n" +
16061606
indent + " }\n",
@@ -1627,7 +1627,7 @@ private static Object generateCompositeProperty(final String propertyName, final
16271627

16281628
sb.append(String.format(
16291629
"\n" +
1630-
indent + " %1$s &%2$s(void)\n" +
1630+
indent + " %1$s &%2$s()\n" +
16311631
indent + " {\n" +
16321632
indent + " m_%2$s.wrap(m_buffer, m_offset + %3$d, m_actingVersion, m_bufferLength);\n" +
16331633
indent + " return m_%2$s;\n" +

0 commit comments

Comments
 (0)