diff --git a/modules/openapi-generator/src/main/resources/C-libcurl/CMakeLists.txt.mustache b/modules/openapi-generator/src/main/resources/C-libcurl/CMakeLists.txt.mustache index ae635d276b75..dfbd9ee55986 100644 --- a/modules/openapi-generator/src/main/resources/C-libcurl/CMakeLists.txt.mustache +++ b/modules/openapi-generator/src/main/resources/C-libcurl/CMakeLists.txt.mustache @@ -6,6 +6,7 @@ cmake_policy(SET CMP0063 NEW) set(CMAKE_C_VISIBILITY_PRESET default) set(CMAKE_VISIBILITY_INLINES_HIDDEN OFF) set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) +set(CMAKE_C_FLAGS "-Werror=implicit-function-declaration -Werror=missing-declarations") option(BUILD_SHARED_LIBS "Build using shared libraries" ON) @@ -14,7 +15,7 @@ find_package(OpenSSL) if (OPENSSL_FOUND) message (STATUS "OPENSSL found") - set(CMAKE_C_FLAGS "-DOPENSSL") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DOPENSSL") if(CMAKE_VERSION VERSION_LESS 3.4) include_directories(${OPENSSL_INCLUDE_DIR}) include_directories(${OPENSSL_INCLUDE_DIRS}) diff --git a/modules/openapi-generator/src/main/resources/C-libcurl/apiClient.c.mustache b/modules/openapi-generator/src/main/resources/C-libcurl/apiClient.c.mustache index 899cb22ef7aa..d032b5de1fa8 100644 --- a/modules/openapi-generator/src/main/resources/C-libcurl/apiClient.c.mustache +++ b/modules/openapi-generator/src/main/resources/C-libcurl/apiClient.c.mustache @@ -173,7 +173,7 @@ void sslConfig_free(sslConfig_t *sslConfig) { free(sslConfig); } -void replaceSpaceWithPlus(char *stringToProcess) { +static void replaceSpaceWithPlus(char *stringToProcess) { for(int i = 0; i < strlen(stringToProcess); i++) { if(stringToProcess[i] == ' ') { stringToProcess[i] = '+'; @@ -181,9 +181,9 @@ void replaceSpaceWithPlus(char *stringToProcess) { } } -char *assembleTargetUrl(const char *basePath, - const char *operationParameter, - list_t *queryParameters) { +static char *assembleTargetUrl(const char *basePath, + const char *operationParameter, + list_t *queryParameters) { int neededBufferSizeForQueryParameters = 0; listEntry_t *listEntry; @@ -234,7 +234,7 @@ char *assembleTargetUrl(const char *basePath, return targetUrl; } -char *assembleHeaderField(char *key, char *value) { +static char *assembleHeaderField(char *key, char *value) { char *header = malloc(strlen(key) + strlen(value) + 3); strcpy(header, key), @@ -244,13 +244,13 @@ char *assembleHeaderField(char *key, char *value) { return header; } -void postData(CURL *handle, const char *bodyParameters, size_t bodyParametersLength) { +static void postData(CURL *handle, const char *bodyParameters, size_t bodyParametersLength) { curl_easy_setopt(handle, CURLOPT_POSTFIELDS, bodyParameters); curl_easy_setopt(handle, CURLOPT_POSTFIELDSIZE_LARGE, (curl_off_t)bodyParametersLength); } -int lengthOfKeyPair(keyValuePair_t *keyPair) { +static int lengthOfKeyPair(keyValuePair_t *keyPair) { long length = 0; if((keyPair->key != NULL) && (keyPair->value != NULL) ) diff --git a/modules/openapi-generator/src/main/resources/C-libcurl/model-body.mustache b/modules/openapi-generator/src/main/resources/C-libcurl/model-body.mustache index ebf15d178911..a835a9b37080 100644 --- a/modules/openapi-generator/src/main/resources/C-libcurl/model-body.mustache +++ b/modules/openapi-generator/src/main/resources/C-libcurl/model-body.mustache @@ -376,7 +376,7 @@ cJSON *{{classname}}_convertToJSON({{classname}}_t *{{classname}}) { {{/isBoolean}} {{#isEnum}} {{#isString}} - if(cJSON_AddStringToObject(item, "{{{baseName}}}", {{{name}}}{{classname}}_ToString({{{classname}}}->{{{name}}})) == NULL) + if(cJSON_AddStringToObject(item, "{{{baseName}}}", {{classname}}_{{name}}_ToString({{{classname}}}->{{{name}}})) == NULL) { goto fail; //Enum } diff --git a/samples/client/others/c/bearerAuth/CMakeLists.txt b/samples/client/others/c/bearerAuth/CMakeLists.txt index 2bfcf58899c0..2dc8b7b11ace 100644 --- a/samples/client/others/c/bearerAuth/CMakeLists.txt +++ b/samples/client/others/c/bearerAuth/CMakeLists.txt @@ -6,6 +6,7 @@ cmake_policy(SET CMP0063 NEW) set(CMAKE_C_VISIBILITY_PRESET default) set(CMAKE_VISIBILITY_INLINES_HIDDEN OFF) set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) +set(CMAKE_C_FLAGS "-Werror=implicit-function-declaration -Werror=missing-declarations") option(BUILD_SHARED_LIBS "Build using shared libraries" ON) @@ -14,7 +15,7 @@ find_package(OpenSSL) if (OPENSSL_FOUND) message (STATUS "OPENSSL found") - set(CMAKE_C_FLAGS "-DOPENSSL") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DOPENSSL") if(CMAKE_VERSION VERSION_LESS 3.4) include_directories(${OPENSSL_INCLUDE_DIR}) include_directories(${OPENSSL_INCLUDE_DIRS}) diff --git a/samples/client/others/c/bearerAuth/src/apiClient.c b/samples/client/others/c/bearerAuth/src/apiClient.c index 6614016d27ae..b9f52e2e1b7f 100644 --- a/samples/client/others/c/bearerAuth/src/apiClient.c +++ b/samples/client/others/c/bearerAuth/src/apiClient.c @@ -89,7 +89,7 @@ void sslConfig_free(sslConfig_t *sslConfig) { free(sslConfig); } -void replaceSpaceWithPlus(char *stringToProcess) { +static void replaceSpaceWithPlus(char *stringToProcess) { for(int i = 0; i < strlen(stringToProcess); i++) { if(stringToProcess[i] == ' ') { stringToProcess[i] = '+'; @@ -97,9 +97,9 @@ void replaceSpaceWithPlus(char *stringToProcess) { } } -char *assembleTargetUrl(const char *basePath, - const char *operationParameter, - list_t *queryParameters) { +static char *assembleTargetUrl(const char *basePath, + const char *operationParameter, + list_t *queryParameters) { int neededBufferSizeForQueryParameters = 0; listEntry_t *listEntry; @@ -150,7 +150,7 @@ char *assembleTargetUrl(const char *basePath, return targetUrl; } -char *assembleHeaderField(char *key, char *value) { +static char *assembleHeaderField(char *key, char *value) { char *header = malloc(strlen(key) + strlen(value) + 3); strcpy(header, key), @@ -160,13 +160,13 @@ char *assembleHeaderField(char *key, char *value) { return header; } -void postData(CURL *handle, const char *bodyParameters, size_t bodyParametersLength) { +static void postData(CURL *handle, const char *bodyParameters, size_t bodyParametersLength) { curl_easy_setopt(handle, CURLOPT_POSTFIELDS, bodyParameters); curl_easy_setopt(handle, CURLOPT_POSTFIELDSIZE_LARGE, (curl_off_t)bodyParametersLength); } -int lengthOfKeyPair(keyValuePair_t *keyPair) { +static int lengthOfKeyPair(keyValuePair_t *keyPair) { long length = 0; if((keyPair->key != NULL) && (keyPair->value != NULL) ) diff --git a/samples/client/petstore/c-useJsonUnformatted/CMakeLists.txt b/samples/client/petstore/c-useJsonUnformatted/CMakeLists.txt index c97fd637cdb9..c5a0b31ca181 100644 --- a/samples/client/petstore/c-useJsonUnformatted/CMakeLists.txt +++ b/samples/client/petstore/c-useJsonUnformatted/CMakeLists.txt @@ -6,6 +6,7 @@ cmake_policy(SET CMP0063 NEW) set(CMAKE_C_VISIBILITY_PRESET default) set(CMAKE_VISIBILITY_INLINES_HIDDEN OFF) set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) +set(CMAKE_C_FLAGS "-Werror=implicit-function-declaration -Werror=missing-declarations") option(BUILD_SHARED_LIBS "Build using shared libraries" ON) @@ -14,7 +15,7 @@ find_package(OpenSSL) if (OPENSSL_FOUND) message (STATUS "OPENSSL found") - set(CMAKE_C_FLAGS "-DOPENSSL") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DOPENSSL") if(CMAKE_VERSION VERSION_LESS 3.4) include_directories(${OPENSSL_INCLUDE_DIR}) include_directories(${OPENSSL_INCLUDE_DIRS}) diff --git a/samples/client/petstore/c-useJsonUnformatted/model/order.c b/samples/client/petstore/c-useJsonUnformatted/model/order.c index bbbc50e1a316..055dd08a3896 100644 --- a/samples/client/petstore/c-useJsonUnformatted/model/order.c +++ b/samples/client/petstore/c-useJsonUnformatted/model/order.c @@ -94,7 +94,7 @@ cJSON *order_convertToJSON(order_t *order) { // order->status if(order->status != openapi_petstore_order_STATUS_NULL) { - if(cJSON_AddStringToObject(item, "status", statusorder_ToString(order->status)) == NULL) + if(cJSON_AddStringToObject(item, "status", order_status_ToString(order->status)) == NULL) { goto fail; //Enum } diff --git a/samples/client/petstore/c-useJsonUnformatted/model/pet.c b/samples/client/petstore/c-useJsonUnformatted/model/pet.c index d95d672eda00..2472e769095d 100644 --- a/samples/client/petstore/c-useJsonUnformatted/model/pet.c +++ b/samples/client/petstore/c-useJsonUnformatted/model/pet.c @@ -148,7 +148,7 @@ cJSON *pet_convertToJSON(pet_t *pet) { // pet->status if(pet->status != openapi_petstore_pet_STATUS_NULL) { - if(cJSON_AddStringToObject(item, "status", statuspet_ToString(pet->status)) == NULL) + if(cJSON_AddStringToObject(item, "status", pet_status_ToString(pet->status)) == NULL) { goto fail; //Enum } diff --git a/samples/client/petstore/c-useJsonUnformatted/src/apiClient.c b/samples/client/petstore/c-useJsonUnformatted/src/apiClient.c index 302cb8bff342..ad06a341a4bb 100644 --- a/samples/client/petstore/c-useJsonUnformatted/src/apiClient.c +++ b/samples/client/petstore/c-useJsonUnformatted/src/apiClient.c @@ -116,7 +116,7 @@ void sslConfig_free(sslConfig_t *sslConfig) { free(sslConfig); } -void replaceSpaceWithPlus(char *stringToProcess) { +static void replaceSpaceWithPlus(char *stringToProcess) { for(int i = 0; i < strlen(stringToProcess); i++) { if(stringToProcess[i] == ' ') { stringToProcess[i] = '+'; @@ -124,9 +124,9 @@ void replaceSpaceWithPlus(char *stringToProcess) { } } -char *assembleTargetUrl(const char *basePath, - const char *operationParameter, - list_t *queryParameters) { +static char *assembleTargetUrl(const char *basePath, + const char *operationParameter, + list_t *queryParameters) { int neededBufferSizeForQueryParameters = 0; listEntry_t *listEntry; @@ -177,7 +177,7 @@ char *assembleTargetUrl(const char *basePath, return targetUrl; } -char *assembleHeaderField(char *key, char *value) { +static char *assembleHeaderField(char *key, char *value) { char *header = malloc(strlen(key) + strlen(value) + 3); strcpy(header, key), @@ -187,13 +187,13 @@ char *assembleHeaderField(char *key, char *value) { return header; } -void postData(CURL *handle, const char *bodyParameters, size_t bodyParametersLength) { +static void postData(CURL *handle, const char *bodyParameters, size_t bodyParametersLength) { curl_easy_setopt(handle, CURLOPT_POSTFIELDS, bodyParameters); curl_easy_setopt(handle, CURLOPT_POSTFIELDSIZE_LARGE, (curl_off_t)bodyParametersLength); } -int lengthOfKeyPair(keyValuePair_t *keyPair) { +static int lengthOfKeyPair(keyValuePair_t *keyPair) { long length = 0; if((keyPair->key != NULL) && (keyPair->value != NULL) ) diff --git a/samples/client/petstore/c/model/order.c b/samples/client/petstore/c/model/order.c index bbbc50e1a316..055dd08a3896 100644 --- a/samples/client/petstore/c/model/order.c +++ b/samples/client/petstore/c/model/order.c @@ -94,7 +94,7 @@ cJSON *order_convertToJSON(order_t *order) { // order->status if(order->status != openapi_petstore_order_STATUS_NULL) { - if(cJSON_AddStringToObject(item, "status", statusorder_ToString(order->status)) == NULL) + if(cJSON_AddStringToObject(item, "status", order_status_ToString(order->status)) == NULL) { goto fail; //Enum } diff --git a/samples/client/petstore/c/model/pet.c b/samples/client/petstore/c/model/pet.c index d95d672eda00..2472e769095d 100644 --- a/samples/client/petstore/c/model/pet.c +++ b/samples/client/petstore/c/model/pet.c @@ -148,7 +148,7 @@ cJSON *pet_convertToJSON(pet_t *pet) { // pet->status if(pet->status != openapi_petstore_pet_STATUS_NULL) { - if(cJSON_AddStringToObject(item, "status", statuspet_ToString(pet->status)) == NULL) + if(cJSON_AddStringToObject(item, "status", pet_status_ToString(pet->status)) == NULL) { goto fail; //Enum } diff --git a/samples/client/petstore/c/src/apiClient.c b/samples/client/petstore/c/src/apiClient.c index 302cb8bff342..ad06a341a4bb 100644 --- a/samples/client/petstore/c/src/apiClient.c +++ b/samples/client/petstore/c/src/apiClient.c @@ -116,7 +116,7 @@ void sslConfig_free(sslConfig_t *sslConfig) { free(sslConfig); } -void replaceSpaceWithPlus(char *stringToProcess) { +static void replaceSpaceWithPlus(char *stringToProcess) { for(int i = 0; i < strlen(stringToProcess); i++) { if(stringToProcess[i] == ' ') { stringToProcess[i] = '+'; @@ -124,9 +124,9 @@ void replaceSpaceWithPlus(char *stringToProcess) { } } -char *assembleTargetUrl(const char *basePath, - const char *operationParameter, - list_t *queryParameters) { +static char *assembleTargetUrl(const char *basePath, + const char *operationParameter, + list_t *queryParameters) { int neededBufferSizeForQueryParameters = 0; listEntry_t *listEntry; @@ -177,7 +177,7 @@ char *assembleTargetUrl(const char *basePath, return targetUrl; } -char *assembleHeaderField(char *key, char *value) { +static char *assembleHeaderField(char *key, char *value) { char *header = malloc(strlen(key) + strlen(value) + 3); strcpy(header, key), @@ -187,13 +187,13 @@ char *assembleHeaderField(char *key, char *value) { return header; } -void postData(CURL *handle, const char *bodyParameters, size_t bodyParametersLength) { +static void postData(CURL *handle, const char *bodyParameters, size_t bodyParametersLength) { curl_easy_setopt(handle, CURLOPT_POSTFIELDS, bodyParameters); curl_easy_setopt(handle, CURLOPT_POSTFIELDSIZE_LARGE, (curl_off_t)bodyParametersLength); } -int lengthOfKeyPair(keyValuePair_t *keyPair) { +static int lengthOfKeyPair(keyValuePair_t *keyPair) { long length = 0; if((keyPair->key != NULL) && (keyPair->value != NULL) )