Fix pedantic warnings
With the latest build system, somehow -Wpedantic got turned on. This is
reasonable given that we expect this code to compile against a number of
targets. Fix void issues.
void function() changes to void function(void)
Change-Id: I89a2dcbcd88c7d163ffdfb67927f71b39cb7aa6f
Signed-off-by: Ed Tanous <etanous@nvidia.com>
diff --git a/generator/cper-generate-cli.c b/generator/cper-generate-cli.c
index 036aaeb..2d65dd0 100644
--- a/generator/cper-generate-cli.c
+++ b/generator/cper-generate-cli.c
@@ -12,7 +12,7 @@
#include <libcper/generator/cper-generate.h>
#include <libcper/generator/sections/gen-section.h>
-void print_help();
+void print_help(void);
int main(int argc, char *argv[])
{
@@ -98,7 +98,7 @@
}
//Prints command help for this CPER generator.
-void print_help()
+void print_help(void)
{
printf(":: --out cper.file [--sections section1 ...] [--single-section sectiontype]\n");
printf("\tGenerates a pseudo-random CPER file with the provided section types and outputs to the given file name.\n\n");
diff --git a/generator/gen-utils.c b/generator/gen-utils.c
index b299f7b..fa0fa99 100644
--- a/generator/gen-utils.c
+++ b/generator/gen-utils.c
@@ -15,7 +15,7 @@
lfsr = seed;
}
-UINT32 cper_rand()
+UINT32 cper_rand(void)
{
lfsr |= lfsr == 0; // if x == 0, set x = 1 instead
lfsr ^= (lfsr & 0x0007ffff) << 13;
diff --git a/include/libcper/generator/gen-utils.h b/include/libcper/generator/gen-utils.h
index 5ba61d1..b8ec9c8 100644
--- a/include/libcper/generator/gen-utils.h
+++ b/include/libcper/generator/gen-utils.h
@@ -18,7 +18,7 @@
UINT8 *generate_random_bytes(size_t size);
void cper_rand_seed(UINT32 seed);
-UINT32 cper_rand();
+UINT32 cper_rand(void);
void create_valid_error_section(UINT8 *start);
diff --git a/include/libcper/log.h b/include/libcper/log.h
index 445d4d2..d4faee0 100644
--- a/include/libcper/log.h
+++ b/include/libcper/log.h
@@ -7,7 +7,7 @@
extern "C" {
#endif
-void cper_set_log_stdio();
+void cper_set_log_stdio(void);
void cper_set_log_custom(void (*fn)(const char *, ...));
void cper_print_log(const char *fmt, ...) __attribute__((format(printf, 1, 2)));
diff --git a/meson.build b/meson.build
index ede0bf1..6316995 100644
--- a/meson.build
+++ b/meson.build
@@ -18,6 +18,7 @@
'-DLIBCPER_EXAMPLES="' + example_dir + '"',
'-DLIBCPER_JSON_SPEC="' + spec_dir + '"',
'-D_POSIX_C_SOURCE=200809L',
+ '-Wno-gnu-statement-expression-from-macro-expansion',
],
language: 'c',
)
diff --git a/tests/base64_test.c b/tests/base64_test.c
index 6fc7825..9912b1e 100644
--- a/tests/base64_test.c
+++ b/tests/base64_test.c
@@ -12,7 +12,7 @@
"f", "fo", "foo", "foob", "fooba", "foobar",
};
-void test_base64_encode_good()
+void test_base64_encode_good(void)
{
int32_t encoded_len = 0;
for (long unsigned int i = 0;
@@ -35,7 +35,7 @@
"f", "f", "fo", "fo", "foo",
};
-void test_base64_decode_good()
+void test_base64_decode_good(void)
{
for (long unsigned int i = 0;
i < sizeof(good_decode_inputs) / sizeof(good_decode_inputs[0]);
diff --git a/tests/base64_test.h b/tests/base64_test.h
index 9e44d6f..0e25543 100644
--- a/tests/base64_test.h
+++ b/tests/base64_test.h
@@ -1,2 +1,4 @@
-void test_base64_encode_good();
-void test_base64_decode_good();
+#ifndef BASE64_TEST_H
+void test_base64_encode_good(void);
+void test_base64_decode_good(void);
+#endif
diff --git a/tests/ir-tests.c b/tests/ir-tests.c
index 82dad70..f8a6990 100644
--- a/tests/ir-tests.c
+++ b/tests/ir-tests.c
@@ -409,7 +409,7 @@
/*
* Non-single section assertions.
*/
-void CompileTimeAssertions_TwoWayConversion()
+void CompileTimeAssertions_TwoWayConversion(void)
{
for (size_t i = 0; i < section_definitions_len; i++) {
//If a conversion one way exists, a conversion the other way must exist.
@@ -422,7 +422,7 @@
}
}
-void CompileTimeAssertions_ShortcodeNoSpaces()
+void CompileTimeAssertions_ShortcodeNoSpaces(void)
{
for (size_t i = 0; i < generator_definitions_len; i++) {
for (int j = 0;
@@ -438,21 +438,21 @@
*/
//Generic processor tests.
-void GenericProcessorTests_IRValid()
+void GenericProcessorTests_IRValid(void)
{
cper_log_section_dual_ir_test("generic");
}
-void GenericProcessorTests_BinaryEqual()
+void GenericProcessorTests_BinaryEqual(void)
{
cper_log_section_dual_binary_test("generic");
}
//IA32/x64 tests.
-void IA32x64Tests_IRValid()
+void IA32x64Tests_IRValid(void)
{
cper_log_section_dual_ir_test("ia32x64");
}
-void IA32x64Tests_BinaryEqual()
+void IA32x64Tests_BinaryEqual(void)
{
cper_log_section_dual_binary_test("ia32x64");
}
@@ -462,162 +462,162 @@
// }
//ARM tests.
-void ArmTests_IRValid()
+void ArmTests_IRValid(void)
{
cper_log_section_dual_ir_test("arm");
}
-void ArmTests_BinaryEqual()
+void ArmTests_BinaryEqual(void)
{
cper_log_section_dual_binary_test("arm");
}
//Memory tests.
-void MemoryTests_IRValid()
+void MemoryTests_IRValid(void)
{
cper_log_section_dual_ir_test("memory");
}
-void MemoryTests_BinaryEqual()
+void MemoryTests_BinaryEqual(void)
{
cper_log_section_dual_binary_test("memory");
}
//Memory 2 tests.
-void Memory2Tests_IRValid()
+void Memory2Tests_IRValid(void)
{
cper_log_section_dual_ir_test("memory2");
}
-void Memory2Tests_BinaryEqual()
+void Memory2Tests_BinaryEqual(void)
{
cper_log_section_dual_binary_test("memory2");
}
//PCIe tests.
-void PCIeTests_IRValid()
+void PCIeTests_IRValid(void)
{
cper_log_section_dual_ir_test("pcie");
}
-void PCIeTests_BinaryEqual()
+void PCIeTests_BinaryEqual(void)
{
cper_log_section_dual_binary_test("pcie");
}
//Firmware tests.
-void FirmwareTests_IRValid()
+void FirmwareTests_IRValid(void)
{
cper_log_section_dual_ir_test("firmware");
}
-void FirmwareTests_BinaryEqual()
+void FirmwareTests_BinaryEqual(void)
{
cper_log_section_dual_binary_test("firmware");
}
//PCI Bus tests.
-void PCIBusTests_IRValid()
+void PCIBusTests_IRValid(void)
{
cper_log_section_dual_ir_test("pcibus");
}
-void PCIBusTests_BinaryEqual()
+void PCIBusTests_BinaryEqual(void)
{
cper_log_section_dual_binary_test("pcibus");
}
//PCI Device tests.
-void PCIDevTests_IRValid()
+void PCIDevTests_IRValid(void)
{
cper_log_section_dual_ir_test("pcidev");
}
-void PCIDevTests_BinaryEqual()
+void PCIDevTests_BinaryEqual(void)
{
cper_log_section_dual_binary_test("pcidev");
}
//Generic DMAr tests.
-void DMArGenericTests_IRValid()
+void DMArGenericTests_IRValid(void)
{
cper_log_section_dual_ir_test("dmargeneric");
}
-void DMArGenericTests_BinaryEqual()
+void DMArGenericTests_BinaryEqual(void)
{
cper_log_section_dual_binary_test("dmargeneric");
}
//VT-d DMAr tests.
-void DMArVtdTests_IRValid()
+void DMArVtdTests_IRValid(void)
{
cper_log_section_dual_ir_test("dmarvtd");
}
-void DMArVtdTests_BinaryEqual()
+void DMArVtdTests_BinaryEqual(void)
{
cper_log_section_dual_binary_test("dmarvtd");
}
//IOMMU DMAr tests.
-void DMArIOMMUTests_IRValid()
+void DMArIOMMUTests_IRValid(void)
{
cper_log_section_dual_ir_test("dmariommu");
}
-void DMArIOMMUTests_BinaryEqual()
+void DMArIOMMUTests_BinaryEqual(void)
{
cper_log_section_dual_binary_test("dmariommu");
}
//CCIX PER tests.
-void CCIXPERTests_IRValid()
+void CCIXPERTests_IRValid(void)
{
cper_log_section_dual_ir_test("ccixper");
}
-void CCIXPERTests_BinaryEqual()
+void CCIXPERTests_BinaryEqual(void)
{
cper_log_section_dual_binary_test("ccixper");
}
//CXL Protocol tests.
-void CXLProtocolTests_IRValid()
+void CXLProtocolTests_IRValid(void)
{
cper_log_section_dual_ir_test("cxlprotocol");
}
-void CXLProtocolTests_BinaryEqual()
+void CXLProtocolTests_BinaryEqual(void)
{
cper_log_section_dual_binary_test("cxlprotocol");
}
//CXL Component tests.
-void CXLComponentTests_IRValid()
+void CXLComponentTests_IRValid(void)
{
cper_log_section_dual_ir_test("cxlcomponent-media");
}
-void CXLComponentTests_BinaryEqual()
+void CXLComponentTests_BinaryEqual(void)
{
cper_log_section_dual_binary_test("cxlcomponent-media");
}
//NVIDIA section tests.
-void NVIDIASectionTests_IRValid()
+void NVIDIASectionTests_IRValid(void)
{
cper_log_section_dual_ir_test("nvidia");
}
-void NVIDIASectionTests_BinaryEqual()
+void NVIDIASectionTests_BinaryEqual(void)
{
cper_log_section_dual_binary_test("nvidia");
}
-void NVIDIACMETSectionTests_IRValid()
+void NVIDIACMETSectionTests_IRValid(void)
{
cper_example_section_ir_test("nvidia_cmet_info");
}
//Unknown section tests.
-void UnknownSectionTests_IRValid()
+void UnknownSectionTests_IRValid(void)
{
cper_log_section_dual_ir_test("unknown");
}
-void UnknownSectionTests_BinaryEqual()
+void UnknownSectionTests_BinaryEqual(void)
{
cper_log_section_dual_binary_test("unknown");
}
//Entrypoint for the testing program.
-int main()
+int main(void)
{
if (GEN_EXAMPLES) {
cper_create_examples("generic");