[mlir] Fix -Wstrict-prototypes warning
authorTom Eccles <tom.eccles@arm.com>
Mon, 5 Dec 2022 12:07:51 +0000 (12:07 +0000)
committerTom Eccles <tom.eccles@arm.com>
Mon, 12 Dec 2022 12:04:58 +0000 (12:04 +0000)
These warnings prevent compilation using clang and
-DLLVM_ENABLE_WERROR=On.

Differential revision: https://reviews.llvm.org/D139322

14 files changed:
mlir/include/mlir-c/BuiltinAttributes.h
mlir/include/mlir-c/BuiltinTypes.h
mlir/include/mlir-c/Dialect/Quant.h
mlir/include/mlir-c/IR.h
mlir/include/mlir-c/RegisterEverything.h
mlir/include/mlir-c/Support.h
mlir/test/CAPI/execution_engine.c
mlir/test/CAPI/ir.c
mlir/test/CAPI/llvm.c
mlir/test/CAPI/pass.c
mlir/test/CAPI/pdl.c
mlir/test/CAPI/quant.c
mlir/test/CAPI/sparse_tensor.c
mlir/tools/mlir-tblgen/PassCAPIGen.cpp

index 79f22376e003a9384e089ee1f3e452d350864ec5..8887897bcb89b04f0717a8d09b14d596bc9f5639 100644 (file)
@@ -23,7 +23,7 @@ extern "C" {
 #endif
 
 /// Returns an empty attribute.
-MLIR_CAPI_EXPORTED MlirAttribute mlirAttributeGetNull();
+MLIR_CAPI_EXPORTED MlirAttribute mlirAttributeGetNull(void);
 
 //===----------------------------------------------------------------------===//
 // Affine map attribute.
index 1c4a1638205bedfcfa61f5f19bbf5527fafe8e7d..000397505479bf0d747e66a0b4a87bd0f6f28399 100644 (file)
@@ -166,7 +166,7 @@ MLIR_CAPI_EXPORTED bool mlirShapedTypeIsDynamicSize(int64_t size);
 
 /// Returns the value indicating a dynamic size in a shaped type. Prefer
 /// mlirShapedTypeIsDynamicSize to direct comparisons with this value.
-MLIR_CAPI_EXPORTED int64_t mlirShapedTypeGetDynamicSize();
+MLIR_CAPI_EXPORTED int64_t mlirShapedTypeGetDynamicSize(void);
 
 /// Checks whether the given value is used as a placeholder for dynamic strides
 /// and offsets in shaped types.
@@ -175,7 +175,7 @@ MLIR_CAPI_EXPORTED bool mlirShapedTypeIsDynamicStrideOrOffset(int64_t val);
 /// Returns the value indicating a dynamic stride or offset in a shaped type.
 /// Prefer mlirShapedTypeGetDynamicStrideOrOffset to direct comparisons with
 /// this value.
-MLIR_CAPI_EXPORTED int64_t mlirShapedTypeGetDynamicStrideOrOffset();
+MLIR_CAPI_EXPORTED int64_t mlirShapedTypeGetDynamicStrideOrOffset(void);
 
 //===----------------------------------------------------------------------===//
 // Vector type.
index 39a17318c73af676fd4b9b41ff5762ff2b2aa403..a7d98dc3c1a7757e025cd6ac90469d8c696280a1 100644 (file)
@@ -26,7 +26,7 @@ MLIR_DECLARE_CAPI_DIALECT_REGISTRATION(quant, quant);
 MLIR_CAPI_EXPORTED bool mlirTypeIsAQuantizedType(MlirType type);
 
 /// Returns the bit flag used to indicate signedness of a quantized type.
-MLIR_CAPI_EXPORTED unsigned mlirQuantizedTypeGetSignedFlag();
+MLIR_CAPI_EXPORTED unsigned mlirQuantizedTypeGetSignedFlag(void);
 
 /// Returns the minimum possible value stored by a quantized type.
 MLIR_CAPI_EXPORTED int64_t mlirQuantizedTypeGetDefaultMinimumForInteger(
index b4266bd0a1f5970cae34c6a6da817c7e9365fea6..cd4f4d3941eb920deb7f5f57c3b19d59a62bb36d 100644 (file)
@@ -82,7 +82,7 @@ typedef struct MlirNamedAttribute MlirNamedAttribute;
 //===----------------------------------------------------------------------===//
 
 /// Creates an MLIR context and transfers its ownership to the caller.
-MLIR_CAPI_EXPORTED MlirContext mlirContextCreate();
+MLIR_CAPI_EXPORTED MlirContext mlirContextCreate(void);
 
 /// Checks if two contexts are equal.
 MLIR_CAPI_EXPORTED bool mlirContextEqual(MlirContext ctx1, MlirContext ctx2);
@@ -184,7 +184,8 @@ struct MlirDialectHandle {
 typedef struct MlirDialectHandle MlirDialectHandle;
 
 #define MLIR_DECLARE_CAPI_DIALECT_REGISTRATION(Name, Namespace)                \
-  MLIR_CAPI_EXPORTED MlirDialectHandle mlirGetDialectHandle__##Namespace##__()
+  MLIR_CAPI_EXPORTED MlirDialectHandle mlirGetDialectHandle__##Namespace##__(  \
+      void)
 
 /// Returns the namespace associated with the provided dialect handle.
 MLIR_CAPI_EXPORTED
@@ -208,7 +209,7 @@ MLIR_CAPI_EXPORTED MlirDialect mlirDialectHandleLoadDialect(MlirDialectHandle,
 //===----------------------------------------------------------------------===//
 
 /// Creates a dialect registry and transfers its ownership to the caller.
-MLIR_CAPI_EXPORTED MlirDialectRegistry mlirDialectRegistryCreate();
+MLIR_CAPI_EXPORTED MlirDialectRegistry mlirDialectRegistryCreate(void);
 
 /// Checks if the dialect registry is null.
 static inline bool mlirDialectRegistryIsNull(MlirDialectRegistry registry) {
@@ -363,7 +364,7 @@ mlirOperationStateEnableResultTypeInference(MlirOperationState *state);
 
 /// Creates new printing flags with defaults, intended for customization.
 /// Must be freed with a call to mlirOpPrintingFlagsDestroy().
-MLIR_CAPI_EXPORTED MlirOpPrintingFlags mlirOpPrintingFlagsCreate();
+MLIR_CAPI_EXPORTED MlirOpPrintingFlags mlirOpPrintingFlagsCreate(void);
 
 /// Destroys printing flags created with mlirOpPrintingFlagsCreate.
 MLIR_CAPI_EXPORTED void mlirOpPrintingFlagsDestroy(MlirOpPrintingFlags flags);
@@ -551,7 +552,7 @@ MLIR_CAPI_EXPORTED void mlirOperationMoveBefore(MlirOperation op,
 //===----------------------------------------------------------------------===//
 
 /// Creates a new empty region and transfers ownership to the caller.
-MLIR_CAPI_EXPORTED MlirRegion mlirRegionCreate();
+MLIR_CAPI_EXPORTED MlirRegion mlirRegionCreate(void);
 
 /// Takes a region owned by the caller and destroys it.
 MLIR_CAPI_EXPORTED void mlirRegionDestroy(MlirRegion region);
@@ -817,10 +818,11 @@ MLIR_CAPI_EXPORTED MlirStringRef mlirIdentifierStr(MlirIdentifier ident);
 
 /// Returns the name of the attribute used to store symbol names compatible with
 /// symbol tables.
-MLIR_CAPI_EXPORTED MlirStringRef mlirSymbolTableGetSymbolAttributeName();
+MLIR_CAPI_EXPORTED MlirStringRef mlirSymbolTableGetSymbolAttributeName(void);
 
 /// Returns the name of the attribute used to store symbol visibility.
-MLIR_CAPI_EXPORTED MlirStringRef mlirSymbolTableGetVisibilityAttributeName();
+MLIR_CAPI_EXPORTED MlirStringRef
+mlirSymbolTableGetVisibilityAttributeName(void);
 
 /// Creates a symbol table for the given operation. If the operation does not
 /// have the SymbolTable trait, returns a null symbol table.
index b98ce154dba67119fb2e2a2c559bde788217c23e..ea2ea86449727e88b3cb77c10e7ed3ea9a0872cb 100644 (file)
@@ -29,7 +29,7 @@ MLIR_CAPI_EXPORTED void mlirRegisterAllDialects(MlirDialectRegistry registry);
 MLIR_CAPI_EXPORTED void mlirRegisterAllLLVMTranslations(MlirContext context);
 
 /// Register all compiler passes of MLIR.
-MLIR_CAPI_EXPORTED void mlirRegisterAllPasses();
+MLIR_CAPI_EXPORTED void mlirRegisterAllPasses(void);
 
 #ifdef __cplusplus
 }
index 5d20fb78d5dc2f1e4015d671ddfec23952b8e9bb..8d0188e319672df185d5c84c711b6153ce9f6a1d 100644 (file)
@@ -127,13 +127,13 @@ inline static bool mlirLogicalResultIsFailure(MlirLogicalResult res) {
 }
 
 /// Creates a logical result representing a success.
-inline static MlirLogicalResult mlirLogicalResultSuccess() {
+inline static MlirLogicalResult mlirLogicalResultSuccess(void) {
   MlirLogicalResult res = {1};
   return res;
 }
 
 /// Creates a logical result representing a failure.
-inline static MlirLogicalResult mlirLogicalResultFailure() {
+inline static MlirLogicalResult mlirLogicalResultFailure(void) {
   MlirLogicalResult res = {0};
   return res;
 }
@@ -160,7 +160,7 @@ MLIR_CAPI_EXPORTED size_t mlirTypeIDHashValue(MlirTypeID typeID);
 //===----------------------------------------------------------------------===//
 
 /// Creates a type id allocator for dynamic type id creation
-MLIR_CAPI_EXPORTED MlirTypeIDAllocator mlirTypeIDAllocatorCreate();
+MLIR_CAPI_EXPORTED MlirTypeIDAllocator mlirTypeIDAllocatorCreate(void);
 
 /// Deallocates the allocator and all allocated type ids
 MLIR_CAPI_EXPORTED void
index fe913698434c7be733ee23c639c279d3ea6cf8c5..96ad8eb1a4029a5b36247d6bc78cfe03b3930f45 100644 (file)
@@ -46,7 +46,7 @@ void lowerModuleToLLVM(MlirContext ctx, MlirModule module) {
 }
 
 // CHECK-LABEL: Running test 'testSimpleExecution'
-void testSimpleExecution() {
+void testSimpleExecution(void) {
   MlirContext ctx = mlirContextCreate();
   registerAllUpstreamDialects(ctx);
 
@@ -84,7 +84,7 @@ void testSimpleExecution() {
   mlirContextDestroy(ctx);
 }
 
-int main() {
+int main(void) {
 
 #define _STRINGIFY(x) #x
 #define STRINGIFY(x) _STRINGIFY(x)
index a4a036c699f9be7ca77a23f53f8d422b895d9148..27b9907c23559810cf4d67ef7f020a95c3574bf3 100644 (file)
@@ -1616,7 +1616,7 @@ int printIntegerSet(MlirContext ctx) {
   return 0;
 }
 
-int registerOnlyStd() {
+int registerOnlyStd(void) {
   MlirContext ctx = mlirContextCreate();
   // The built-in dialect is always loaded.
   if (mlirContextGetNumLoadedDialects(ctx) != 1)
@@ -1670,7 +1670,7 @@ int registerOnlyStd() {
 }
 
 /// Tests backreference APIs
-static int testBackreferences() {
+static int testBackreferences(void) {
   fprintf(stderr, "@test_backreferences\n");
 
   MlirContext ctx = mlirContextCreate();
@@ -1708,7 +1708,7 @@ static int testBackreferences() {
 }
 
 /// Tests operand APIs.
-int testOperands() {
+int testOperands(void) {
   fprintf(stderr, "@testOperands\n");
   // CHECK-LABEL: @testOperands
 
@@ -1778,7 +1778,7 @@ int testOperands() {
 }
 
 /// Tests clone APIs.
-int testClone() {
+int testClone(void) {
   fprintf(stderr, "@testClone\n");
   // CHECK-LABEL: @testClone
 
@@ -2023,7 +2023,7 @@ int testSymbolTable(MlirContext ctx) {
   return 0;
 }
 
-int testDialectRegistry() {
+int testDialectRegistry(void) {
   fprintf(stderr, "@testDialectRegistry\n");
 
   MlirDialectRegistry registry = mlirDialectRegistryCreate();
@@ -2053,7 +2053,7 @@ int testDialectRegistry() {
   return 0;
 }
 
-void testDiagnostics() {
+void testDiagnostics(void) {
   MlirContext ctx = mlirContextCreate();
   MlirDiagnosticHandlerID id = mlirContextAttachDiagnosticHandler(
       ctx, errorHandler, (void *)42, deleteUserData);
@@ -2104,7 +2104,7 @@ void testDiagnostics() {
   mlirContextDestroy(ctx);
 }
 
-int main() {
+int main(void) {
   MlirContext ctx = mlirContextCreate();
   registerAllUpstreamDialects(ctx);
   mlirContextGetOrLoadDialect(ctx, mlirStringRefCreateFromCString("func"));
index 8bd96ceb5daaff2343c14ed1ccaf08d2274ed18e..82e1660c15a48258e26f56edf63aeb3c4cd7af5e 100644 (file)
@@ -70,7 +70,7 @@ static void testTypeCreation(MlirContext ctx) {
           mlirTypeEqual(i32_i64_s, i32_i64_s_ref));
 }
 
-int main() {
+int main(void) {
   MlirContext ctx = mlirContextCreate();
   mlirDialectHandleRegisterDialect(mlirGetDialectHandle__llvm__(), ctx);
   mlirContextGetOrLoadDialect(ctx, mlirStringRefCreateFromCString("llvm"));
index 87430b9e479780203bc83bebb234827b348b1cc2..42b5ce7080cac2bb46b3ba96de979f9c2170dfb3 100644 (file)
@@ -29,7 +29,7 @@ static void registerAllUpstreamDialects(MlirContext ctx) {
   mlirDialectRegistryDestroy(registry);
 }
 
-void testRunPassOnModule() {
+void testRunPassOnModule(void) {
   MlirContext ctx = mlirContextCreate();
   registerAllUpstreamDialects(ctx);
 
@@ -67,7 +67,7 @@ void testRunPassOnModule() {
   mlirContextDestroy(ctx);
 }
 
-void testRunPassOnNestedModule() {
+void testRunPassOnNestedModule(void) {
   MlirContext ctx = mlirContextCreate();
   registerAllUpstreamDialects(ctx);
 
@@ -138,7 +138,7 @@ static void dontPrint(MlirStringRef str, void *userData) {
   (void)userData;
 }
 
-void testPrintPassPipeline() {
+void testPrintPassPipeline(void) {
   MlirContext ctx = mlirContextCreate();
   MlirPassManager pm = mlirPassManagerCreateOnOperation(
       ctx, mlirStringRefCreateFromCString("any"));
@@ -175,7 +175,7 @@ void testPrintPassPipeline() {
   mlirContextDestroy(ctx);
 }
 
-void testParsePassPipeline() {
+void testParsePassPipeline(void) {
   MlirContext ctx = mlirContextCreate();
   MlirPassManager pm = mlirPassManagerCreate(ctx);
   // Try parse a pipeline.
@@ -233,7 +233,7 @@ void testParsePassPipeline() {
   mlirContextDestroy(ctx);
 }
 
-void testParseErrorCapture() {
+void testParseErrorCapture(void) {
   // CHECK-LABEL: testParseErrorCapture:
   fprintf(stderr, "\nTEST: testParseErrorCapture:\n");
 
@@ -335,7 +335,7 @@ MlirExternalPassCallbacks makeTestExternalPassCallbacks(
                                      testCloneExternalPass, runPass};
 }
 
-void testExternalPass() {
+void testExternalPass(void) {
   MlirContext ctx = mlirContextCreate();
   registerAllUpstreamDialects(ctx);
 
@@ -591,7 +591,7 @@ void testExternalPass() {
   mlirContextDestroy(ctx);
 }
 
-int main() {
+int main(void) {
   testRunPassOnModule();
   testRunPassOnNestedModule();
   testPrintPassPipeline();
index c7ef98b4d6e7666249b6ce2a5690ae58caaffc28..673ad8d6af7e46fb0936ea7f2aff7e2f11fcf838 100644 (file)
@@ -325,7 +325,7 @@ void testValueType(MlirContext ctx) {
   fprintf(stderr, "\n\n");
 }
 
-int main() {
+int main(void) {
   MlirContext ctx = mlirContextCreate();
   mlirDialectHandleRegisterDialect(mlirGetDialectHandle__pdl__(), ctx);
   testAttributeType(ctx);
index 0ec15c37e0bb7f356630c19c937f353d6458afa1..0a09e084119f716b2446b2d401d44116eb5767bc 100644 (file)
@@ -226,7 +226,7 @@ void testCalibratedType(MlirContext ctx) {
   fprintf(stderr, "\n\n");
 }
 
-int main() {
+int main(void) {
   MlirContext ctx = mlirContextCreate();
   mlirDialectHandleRegisterDialect(mlirGetDialectHandle__quant__(), ctx);
   testTypeHierarchy(ctx);
index 58af741c19b84ed9391e706de1d23cbbe1ceb1d4..ebb76ebc34eb205bf4888220998598c8bf973735 100644 (file)
@@ -74,7 +74,7 @@ static int testRoundtripEncoding(MlirContext ctx) {
   return 0;
 }
 
-int main() {
+int main(void) {
   MlirContext ctx = mlirContextCreate();
   mlirDialectHandleRegisterDialect(mlirGetDialectHandle__sparse_tensor__(),
                                    ctx);
index 72275e756d4d1ac072ceec604a04cd6cb3edd5f0..9f33a4129aaccaa73a02cf57cc68cd6523729a2c 100644 (file)
@@ -32,8 +32,8 @@ static llvm::cl::opt<std::string>
 
 const char *const passDecl = R"(
 /* Create {0} Pass. */
-MLIR_CAPI_EXPORTED MlirPass mlirCreate{0}{1}();
-MLIR_CAPI_EXPORTED void mlirRegister{0}{1}();
+MLIR_CAPI_EXPORTED MlirPass mlirCreate{0}{1}(void);
+MLIR_CAPI_EXPORTED void mlirRegister{0}{1}(void);
 
 )";
 
@@ -59,7 +59,8 @@ const char *const fileFooter = R"(
 static bool emitCAPIHeader(const llvm::RecordKeeper &records, raw_ostream &os) {
   os << fileHeader;
   os << "// Registration for the entire group\n";
-  os << "MLIR_CAPI_EXPORTED void mlirRegister" << groupName << "Passes();\n\n";
+  os << "MLIR_CAPI_EXPORTED void mlirRegister" << groupName
+     << "Passes(void);\n\n";
   for (const auto *def : records.getAllDerivedDefinitions("PassBase")) {
     Pass pass(def);
     StringRef defName = pass.getDef()->getName();
@@ -70,10 +71,10 @@ static bool emitCAPIHeader(const llvm::RecordKeeper &records, raw_ostream &os) {
 }
 
 const char *const passCreateDef = R"(
-MlirPass mlirCreate{0}{1}() {
+MlirPass mlirCreate{0}{1}(void) {
   return wrap({2}.release());
 }
-void mlirRegister{0}{1}() {
+void mlirRegister{0}{1}(void) {
   register{1}();
 }
 
@@ -85,7 +86,7 @@ const char *const passGroupRegistrationCode = R"(
 // {0} Group Registration
 //===----------------------------------------------------------------------===//
 
-void mlirRegister{0}Passes() {{
+void mlirRegister{0}Passes(void) {{
   register{0}Passes();
 }
 )";