diff options
author | Tom Eccles <tom.eccles@arm.com> | 2022-12-05 12:07:51 +0000 |
---|---|---|
committer | Tom Eccles <tom.eccles@arm.com> | 2022-12-12 12:04:58 +0000 |
commit | 5d91f79fced13604ff401e5f5a6d5c3a9062ab20 (patch) | |
tree | baa54edda0999567544fd03d8a91abf2754c334c /mlir | |
parent | 0c51f9cd8f05a91985c15ac9c6e0d993de6481c1 (diff) | |
download | llvm-5d91f79fced13604ff401e5f5a6d5c3a9062ab20.tar.gz |
[mlir] Fix -Wstrict-prototypes warning
These warnings prevent compilation using clang and
-DLLVM_ENABLE_WERROR=On.
Differential revision: https://reviews.llvm.org/D139322
Diffstat (limited to 'mlir')
-rw-r--r-- | mlir/include/mlir-c/BuiltinAttributes.h | 2 | ||||
-rw-r--r-- | mlir/include/mlir-c/BuiltinTypes.h | 4 | ||||
-rw-r--r-- | mlir/include/mlir-c/Dialect/Quant.h | 2 | ||||
-rw-r--r-- | mlir/include/mlir-c/IR.h | 16 | ||||
-rw-r--r-- | mlir/include/mlir-c/RegisterEverything.h | 2 | ||||
-rw-r--r-- | mlir/include/mlir-c/Support.h | 6 | ||||
-rw-r--r-- | mlir/test/CAPI/execution_engine.c | 4 | ||||
-rw-r--r-- | mlir/test/CAPI/ir.c | 14 | ||||
-rw-r--r-- | mlir/test/CAPI/llvm.c | 2 | ||||
-rw-r--r-- | mlir/test/CAPI/pass.c | 14 | ||||
-rw-r--r-- | mlir/test/CAPI/pdl.c | 2 | ||||
-rw-r--r-- | mlir/test/CAPI/quant.c | 2 | ||||
-rw-r--r-- | mlir/test/CAPI/sparse_tensor.c | 2 | ||||
-rw-r--r-- | mlir/tools/mlir-tblgen/PassCAPIGen.cpp | 13 |
14 files changed, 44 insertions, 41 deletions
diff --git a/mlir/include/mlir-c/BuiltinAttributes.h b/mlir/include/mlir-c/BuiltinAttributes.h index 79f22376e003..8887897bcb89 100644 --- a/mlir/include/mlir-c/BuiltinAttributes.h +++ b/mlir/include/mlir-c/BuiltinAttributes.h @@ -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. diff --git a/mlir/include/mlir-c/BuiltinTypes.h b/mlir/include/mlir-c/BuiltinTypes.h index 1c4a1638205b..000397505479 100644 --- a/mlir/include/mlir-c/BuiltinTypes.h +++ b/mlir/include/mlir-c/BuiltinTypes.h @@ -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. diff --git a/mlir/include/mlir-c/Dialect/Quant.h b/mlir/include/mlir-c/Dialect/Quant.h index 39a17318c73a..a7d98dc3c1a7 100644 --- a/mlir/include/mlir-c/Dialect/Quant.h +++ b/mlir/include/mlir-c/Dialect/Quant.h @@ -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( diff --git a/mlir/include/mlir-c/IR.h b/mlir/include/mlir-c/IR.h index b4266bd0a1f5..cd4f4d3941eb 100644 --- a/mlir/include/mlir-c/IR.h +++ b/mlir/include/mlir-c/IR.h @@ -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. diff --git a/mlir/include/mlir-c/RegisterEverything.h b/mlir/include/mlir-c/RegisterEverything.h index b98ce154dba6..ea2ea8644972 100644 --- a/mlir/include/mlir-c/RegisterEverything.h +++ b/mlir/include/mlir-c/RegisterEverything.h @@ -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 } diff --git a/mlir/include/mlir-c/Support.h b/mlir/include/mlir-c/Support.h index 5d20fb78d5dc..8d0188e31967 100644 --- a/mlir/include/mlir-c/Support.h +++ b/mlir/include/mlir-c/Support.h @@ -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 diff --git a/mlir/test/CAPI/execution_engine.c b/mlir/test/CAPI/execution_engine.c index fe913698434c..96ad8eb1a402 100644 --- a/mlir/test/CAPI/execution_engine.c +++ b/mlir/test/CAPI/execution_engine.c @@ -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) diff --git a/mlir/test/CAPI/ir.c b/mlir/test/CAPI/ir.c index a4a036c699f9..27b9907c2355 100644 --- a/mlir/test/CAPI/ir.c +++ b/mlir/test/CAPI/ir.c @@ -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")); diff --git a/mlir/test/CAPI/llvm.c b/mlir/test/CAPI/llvm.c index 8bd96ceb5daa..82e1660c15a4 100644 --- a/mlir/test/CAPI/llvm.c +++ b/mlir/test/CAPI/llvm.c @@ -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")); diff --git a/mlir/test/CAPI/pass.c b/mlir/test/CAPI/pass.c index 87430b9e4797..42b5ce7080ca 100644 --- a/mlir/test/CAPI/pass.c +++ b/mlir/test/CAPI/pass.c @@ -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(); diff --git a/mlir/test/CAPI/pdl.c b/mlir/test/CAPI/pdl.c index c7ef98b4d6e7..673ad8d6af7e 100644 --- a/mlir/test/CAPI/pdl.c +++ b/mlir/test/CAPI/pdl.c @@ -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); diff --git a/mlir/test/CAPI/quant.c b/mlir/test/CAPI/quant.c index 0ec15c37e0bb..0a09e084119f 100644 --- a/mlir/test/CAPI/quant.c +++ b/mlir/test/CAPI/quant.c @@ -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); diff --git a/mlir/test/CAPI/sparse_tensor.c b/mlir/test/CAPI/sparse_tensor.c index 58af741c19b8..ebb76ebc34eb 100644 --- a/mlir/test/CAPI/sparse_tensor.c +++ b/mlir/test/CAPI/sparse_tensor.c @@ -74,7 +74,7 @@ static int testRoundtripEncoding(MlirContext ctx) { return 0; } -int main() { +int main(void) { MlirContext ctx = mlirContextCreate(); mlirDialectHandleRegisterDialect(mlirGetDialectHandle__sparse_tensor__(), ctx); diff --git a/mlir/tools/mlir-tblgen/PassCAPIGen.cpp b/mlir/tools/mlir-tblgen/PassCAPIGen.cpp index 72275e756d4d..9f33a4129aac 100644 --- a/mlir/tools/mlir-tblgen/PassCAPIGen.cpp +++ b/mlir/tools/mlir-tblgen/PassCAPIGen.cpp @@ -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(); } )"; |