Skip to content

Commit b714e0b

Browse files
authored
set -std=c89 for C-flags (#150)
* set -std=c89 for C-flags * specify -std=c89 also for other compilers * update C-interface * updated tests
1 parent 50a1149 commit b714e0b

28 files changed

Lines changed: 653 additions & 658 deletions

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,13 @@ if(MSVC)
6262
set( CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON )
6363
elseif(${CMAKE_COMPILER_IS_GNUCXX})
6464
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wpedantic")
65-
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wpedantic")
65+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c89 -Wall -Wpedantic")
6666
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 5.0)
6767
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wsuggest-override -Wignored-qualifiers")
6868
endif()
6969
else()
7070
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wpedantic")
71-
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wpedantic")
71+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c89 -Wall -Wpedantic")
7272
endif()
7373

7474
message("CMAKE_CXX_FLAGS:" ${CMAKE_CXX_FLAGS})

co_sim_io/c/co_sim_io_c.h

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,29 @@
1-
// ______ _____ _ ________
2-
// / ____/___ / ___/(_)___ ___ / _/ __ |
3-
// / / / __ \\__ \/ / __ `__ \ / // / / /
4-
// / /___/ /_/ /__/ / / / / / / // // /_/ /
5-
// \____/\____/____/_/_/ /_/ /_/___/\____/
6-
// Kratos CoSimulationApplication
7-
//
8-
// License: BSD License, see license.txt
9-
//
10-
// Main authors: Philipp Bucher (https://github.com/philbucher)
11-
//
1+
/* ______ _____ _ ________
2+
/ ____/___ / ___/(_)___ ___ / _/ __ |
3+
/ / / __ \\__ \/ / __ `__ \ / // / / /
4+
/ /___/ /_/ /__/ / / / / / / // // /_/ /
5+
\____/\____/____/_/_/ /_/ /_/___/\____/
6+
Kratos CoSimulationApplication
7+
8+
License: BSD License, see license.txt
9+
10+
Main authors: Philipp Bucher (https://github.com/philbucher)
11+
*/
1212

1313
#ifndef CO_SIM_IO_C_INCLUDED
1414
#define CO_SIM_IO_C_INCLUDED
1515

16-
// C Interface for CoSimulation
17-
// see "co_sim_io.hpp"
16+
/* C Interface for CoSimulation
17+
see "co_sim_io.hpp"
18+
*/
1819

1920
#include <stdio.h>
2021

2122
#include "co_sim_io_c_info.h"
2223
#include "co_sim_io_c_model_part.h"
2324

2425
#ifdef __cplusplus
25-
extern "C" { // Define extern C if C++ compiler is used
26+
extern "C" { /* Define extern C if C++ compiler is used */
2627
#endif
2728

2829
enum CoSimIO_ConnectionStatus
@@ -84,4 +85,4 @@ void CoSimIO_Free (void* ptr);
8485
}
8586
#endif
8687

87-
#endif // CO_SIM_IO_C_INCLUDED
88+
#endif /* CO_SIM_IO_C_INCLUDED */

co_sim_io/c/co_sim_io_c_info.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
// ______ _____ _ ________
2-
// / ____/___ / ___/(_)___ ___ / _/ __ |
3-
// / / / __ \\__ \/ / __ `__ \ / // / / /
4-
// / /___/ /_/ /__/ / / / / / / // // /_/ /
5-
// \____/\____/____/_/_/ /_/ /_/___/\____/
6-
// Kratos CoSimulationApplication
7-
//
8-
// License: BSD License, see license.txt
9-
//
10-
// Main authors: Philipp Bucher (https://github.com/philbucher)
11-
//
1+
/* ______ _____ _ ________
2+
/ ____/___ / ___/(_)___ ___ / _/ __ |
3+
/ / / __ \\__ \/ / __ `__ \ / // / / /
4+
/ /___/ /_/ /__/ / / / / / / // // /_/ /
5+
\____/\____/____/_/_/ /_/ /_/___/\____/
6+
Kratos CoSimulationApplication
7+
8+
License: BSD License, see license.txt
9+
10+
Main authors: Philipp Bucher (https://github.com/philbucher)
11+
*/
1212

1313
#ifndef CO_SIM_IO_C_INFO_INCLUDED
1414
#define CO_SIM_IO_C_INFO_INCLUDED
@@ -41,4 +41,4 @@ void CoSimIO_Info_SetDouble(CoSimIO_Info I_Info, const char* I_Key, const double
4141
void CoSimIO_Info_SetBool(CoSimIO_Info I_Info, const char* I_Key, const int I_Value);
4242
void CoSimIO_Info_SetString(CoSimIO_Info I_Info, const char* I_Key, const char* I_Value);
4343

44-
#endif // CO_SIM_IO_C_INFO_INCLUDED
44+
#endif /* CO_SIM_IO_C_INFO_INCLUDED */

co_sim_io/c/co_sim_io_c_model_part.h

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
// ______ _____ _ ________
2-
// / ____/___ / ___/(_)___ ___ / _/ __ |
3-
// / / / __ \\__ \/ / __ `__ \ / // / / /
4-
// / /___/ /_/ /__/ / / / / / / // // /_/ /
5-
// \____/\____/____/_/_/ /_/ /_/___/\____/
6-
// Kratos CoSimulationApplication
7-
//
8-
// License: BSD License, see license.txt
9-
//
10-
// Main authors: Philipp Bucher (https://github.com/philbucher)
11-
//
1+
/* ______ _____ _ ________
2+
/ ____/___ / ___/(_)___ ___ / _/ __ |
3+
/ / / __ \\__ \/ / __ `__ \ / // / / /
4+
/ /___/ /_/ /__/ / / / / / / // // /_/ /
5+
\____/\____/____/_/_/ /_/ /_/___/\____/
6+
Kratos CoSimulationApplication
7+
8+
License: BSD License, see license.txt
9+
10+
Main authors: Philipp Bucher (https://github.com/philbucher)
11+
*/
1212

1313
#ifndef CO_SIM_IO_C_MODEL_PART_INCLUDED
1414
#define CO_SIM_IO_C_MODEL_PART_INCLUDED
@@ -56,21 +56,21 @@ typedef enum
5656
} CoSimIO_ElementType;
5757

5858

59-
// Node functions
59+
/* Node functions */
6060
int CoSimIO_Node_Id(CoSimIO_Node I_Node);
6161
double CoSimIO_Node_X(CoSimIO_Node I_Node);
6262
double CoSimIO_Node_Y(CoSimIO_Node I_Node);
6363
double CoSimIO_Node_Z(CoSimIO_Node I_Node);
6464
double CoSimIO_Node_Coordinate(CoSimIO_Node I_Node, const int I_Index);
6565

6666

67-
// Element functions
67+
/* Element functions */
6868
int CoSimIO_Element_Id(CoSimIO_Element I_Element);
6969
CoSimIO_ElementType CoSimIO_Element_Type(CoSimIO_Element I_Element);
7070
int CoSimIO_Element_NumberOfNodes(CoSimIO_Element I_Element);
7171
CoSimIO_Node CoSimIO_Element_GetNodeByIndex(CoSimIO_Element I_Element, const int I_Index);
7272

73-
// ModelPart functions
73+
/* ModelPart functions */
7474
CoSimIO_ModelPart CoSimIO_CreateModelPart(const char* I_Name);
7575

7676
int CoSimIO_FreeModelPart(CoSimIO_ModelPart I_ModelPart);
@@ -97,4 +97,4 @@ CoSimIO_Element CoSimIO_ModelPart_CreateNewElement(
9797
const int* I_Connectivities);
9898

9999

100-
#endif // CO_SIM_IO_C_MODEL_PART_INCLUDED
100+
#endif /* CO_SIM_IO_C_MODEL_PART_INCLUDED */

tests/co_sim_io/c/checks.h

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
// ______ _____ _ ________
2-
// / ____/___ / ___/(_)___ ___ / _/ __ |
3-
// / / / __ \\__ \/ / __ `__ \ / // / / /
4-
// / /___/ /_/ /__/ / / / / / / // // /_/ /
5-
// \____/\____/____/_/_/ /_/ /_/___/\____/
6-
// Kratos CoSimulationApplication
7-
//
8-
// License: BSD License, see license.txt
9-
//
10-
// Main authors: Philipp Bucher (https://github.com/philbucher)
11-
//
12-
13-
// this file contains some test-macros
14-
15-
// System includes
1+
/* ______ _____ _ ________
2+
/ ____/___ / ___/(_)___ ___ / _/ __ |
3+
/ / / __ \\__ \/ / __ `__ \ / // / / /
4+
/ /___/ /_/ /__/ / / / / / / // // /_/ /
5+
\____/\____/____/_/_/ /_/ /_/___/\____/
6+
Kratos CoSimulationApplication
7+
8+
License: BSD License, see license.txt
9+
10+
Main authors: Philipp Bucher (https://github.com/philbucher)
11+
*/
12+
13+
/* this file contains some test-macros */
14+
15+
/* System includes */
1616
#include <stdio.h>
1717
#include <math.h>
1818
#include <string.h>

tests/co_sim_io/c/info/test_info_bool.c

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,26 @@
1-
// ______ _____ _ ________
2-
// / ____/___ / ___/(_)___ ___ / _/ __ |
3-
// / / / __ \\__ \/ / __ `__ \ / // / / /
4-
// / /___/ /_/ /__/ / / / / / / // // /_/ /
5-
// \____/\____/____/_/_/ /_/ /_/___/\____/
6-
// Kratos CoSimulationApplication
7-
//
8-
// License: BSD License, see license.txt
9-
//
10-
// Main authors: Philipp Bucher (https://github.com/philbucher)
11-
//
12-
13-
// Project includes
1+
/* ______ _____ _ ________
2+
/ ____/___ / ___/(_)___ ___ / _/ __ |
3+
/ / / __ \\__ \/ / __ `__ \ / // / / /
4+
/ /___/ /_/ /__/ / / / / / / // // /_/ /
5+
\____/\____/____/_/_/ /_/ /_/___/\____/
6+
Kratos CoSimulationApplication
7+
8+
License: BSD License, see license.txt
9+
10+
Main authors: Philipp Bucher (https://github.com/philbucher)
11+
*/
12+
13+
/* Project includes */
1414
#include "c/co_sim_io_c.h"
1515

1616
#include "../checks.h"
1717

1818
int main()
1919
{
20-
CoSimIO_Info info = CoSimIO_CreateInfo();
20+
/* declaring variables */
21+
CoSimIO_Info info;
22+
23+
info = CoSimIO_CreateInfo();
2124

2225
COSIMIO_CHECK_FALSE(CoSimIO_Info_Has(info, "is_converged"));
2326

tests/co_sim_io/c/info/test_info_clear.c

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,26 @@
1-
// ______ _____ _ ________
2-
// / ____/___ / ___/(_)___ ___ / _/ __ |
3-
// / / / __ \\__ \/ / __ `__ \ / // / / /
4-
// / /___/ /_/ /__/ / / / / / / // // /_/ /
5-
// \____/\____/____/_/_/ /_/ /_/___/\____/
6-
// Kratos CoSimulationApplication
7-
//
8-
// License: BSD License, see license.txt
9-
//
10-
// Main authors: Philipp Bucher (https://github.com/philbucher)
11-
//
12-
13-
// Project includes
1+
/* ______ _____ _ ________
2+
/ ____/___ / ___/(_)___ ___ / _/ __ |
3+
/ / / __ \\__ \/ / __ `__ \ / // / / /
4+
/ /___/ /_/ /__/ / / / / / / // // /_/ /
5+
\____/\____/____/_/_/ /_/ /_/___/\____/
6+
Kratos CoSimulationApplication
7+
8+
License: BSD License, see license.txt
9+
10+
Main authors: Philipp Bucher (https://github.com/philbucher)
11+
*/
12+
13+
/* Project includes */
1414
#include "c/co_sim_io_c.h"
1515

1616
#include "../checks.h"
1717

1818
int main()
1919
{
20-
CoSimIO_Info info = CoSimIO_CreateInfo();
20+
/* declaring variables */
21+
CoSimIO_Info info;
22+
23+
info = CoSimIO_CreateInfo();
2124

2225
COSIMIO_CHECK_INT_EQUAL(CoSimIO_Info_Size(info), 0);
2326

tests/co_sim_io/c/info/test_info_copy.c

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,26 @@
1-
// ______ _____ _ ________
2-
// / ____/___ / ___/(_)___ ___ / _/ __ |
3-
// / / / __ \\__ \/ / __ `__ \ / // / / /
4-
// / /___/ /_/ /__/ / / / / / / // // /_/ /
5-
// \____/\____/____/_/_/ /_/ /_/___/\____/
6-
// Kratos CoSimulationApplication
7-
//
8-
// License: BSD License, see license.txt
9-
//
10-
// Main authors: Philipp Bucher (https://github.com/philbucher)
11-
//
12-
13-
// Project includes
1+
/* ______ _____ _ ________
2+
/ ____/___ / ___/(_)___ ___ / _/ __ |
3+
/ / / __ \\__ \/ / __ `__ \ / // / / /
4+
/ /___/ /_/ /__/ / / / / / / // // /_/ /
5+
\____/\____/____/_/_/ /_/ /_/___/\____/
6+
Kratos CoSimulationApplication
7+
8+
License: BSD License, see license.txt
9+
10+
Main authors: Philipp Bucher (https://github.com/philbucher)
11+
*/
12+
13+
/* Project includes */
1414
#include "c/co_sim_io_c.h"
1515

1616
#include "../checks.h"
1717

1818
int main()
1919
{
20-
CoSimIO_Info info = CoSimIO_CreateInfo();
20+
/* declaring variables */
21+
CoSimIO_Info info, copied_info;
22+
23+
info = CoSimIO_CreateInfo();
2124

2225
COSIMIO_CHECK_INT_EQUAL(CoSimIO_Info_Size(info), 0);
2326

@@ -41,8 +44,8 @@ int main()
4144

4245
COSIMIO_CHECK_INT_EQUAL(CoSimIO_Info_Size(info), 5);
4346

44-
CoSimIO_Info copied_info = CoSimIO_CopyInfo(info);
45-
CoSimIO_FreeInfo(info); // delete this here to make sure "copied_info" is a deep and not a shallow copy
47+
copied_info = CoSimIO_CopyInfo(info);
48+
CoSimIO_FreeInfo(info); /* delete this here to make sure "copied_info" is a deep and not a shallow copy */
4649

4750
COSIMIO_CHECK_TRUE(CoSimIO_Info_Has(copied_info, "echo_level"));
4851
COSIMIO_CHECK_TRUE(CoSimIO_Info_Has(copied_info, "iter"));

tests/co_sim_io/c/info/test_info_double.c

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,26 @@
1-
// ______ _____ _ ________
2-
// / ____/___ / ___/(_)___ ___ / _/ __ |
3-
// / / / __ \\__ \/ / __ `__ \ / // / / /
4-
// / /___/ /_/ /__/ / / / / / / // // /_/ /
5-
// \____/\____/____/_/_/ /_/ /_/___/\____/
6-
// Kratos CoSimulationApplication
7-
//
8-
// License: BSD License, see license.txt
9-
//
10-
// Main authors: Philipp Bucher (https://github.com/philbucher)
11-
//
12-
13-
// Project includes
1+
/* ______ _____ _ ________
2+
/ ____/___ / ___/(_)___ ___ / _/ __ |
3+
/ / / __ \\__ \/ / __ `__ \ / // / / /
4+
/ /___/ /_/ /__/ / / / / / / // // /_/ /
5+
\____/\____/____/_/_/ /_/ /_/___/\____/
6+
Kratos CoSimulationApplication
7+
8+
License: BSD License, see license.txt
9+
10+
Main authors: Philipp Bucher (https://github.com/philbucher)
11+
*/
12+
13+
/* Project includes */
1414
#include "c/co_sim_io_c.h"
1515

1616
#include "../checks.h"
1717

1818
int main()
1919
{
20-
CoSimIO_Info info = CoSimIO_CreateInfo();
20+
/* declaring variables */
21+
CoSimIO_Info info;
22+
23+
info = CoSimIO_CreateInfo();
2124

2225
COSIMIO_CHECK_FALSE(CoSimIO_Info_Has(info, "tolerance"));
2326

0 commit comments

Comments
 (0)