Skip to content

Commit 4003b50

Browse files
authored
Merge pull request #225 from tetengo/c17
C17
2 parents f6f432a + 2afb925 commit 4003b50

File tree

64 files changed

+1455
-1575
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+1455
-1575
lines changed

configure.ac

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ AX_CXX_COMPILE_STDCXX_17([noext], [mandatory])
107107

108108
#### Program Checks ####
109109
AC_PROG_CXX
110-
AC_PROG_CC
110+
AC_PROG_CC_C99
111111
AC_PROG_CPP
112112
AC_PROG_LIBTOOL
113113
LT_INIT
@@ -123,7 +123,7 @@ AC_CHECK_PROG(IWYU, include-what-you-use, include-what-you-use)
123123
test -z $IWYU && \
124124
AC_MSG_WARN([You cannot check the includes for lack of include-what-you-use.])
125125
AC_SUBST([IWYU_OPTS_CXX], "-Xiwyu --max_line_length=200 -x c++ -std=c++17 -DIWYU")
126-
AC_SUBST([IWYU_OPTS_C], "-Xiwyu --max_line_length=200 -x c -std=c89 -DIWYU")
126+
AC_SUBST([IWYU_OPTS_C], "-Xiwyu --max_line_length=200 -x c -std=c17 -DIWYU")
127127
AC_SUBST([IWYU_IMP_PATH], "kogyan/tool/iwyu_mappings.imp")
128128

129129
AC_ARG_WITH(
@@ -199,7 +199,7 @@ AC_SUBST([CPPFLAGS], "${CPPFLAGS} ${BOOST_CPPFLAGS}")
199199

200200
#### Compilation Options ####
201201
AC_SUBST([CXXFLAGS], "${CXXFLAGS} -Werror -Wall -Wextra -pedantic-errors")
202-
AC_SUBST([CFLAGS], "${CFLAGS} -std=c89 -Werror -Wall -Wextra -pedantic-errors")
202+
AC_SUBST([CFLAGS], "${CFLAGS} -std=c17 -Werror -Wall -Wextra -pedantic-errors")
203203

204204
#### Output ####
205205
AC_OUTPUT

kogyan

library/json/c/include/tetengo/Makefile.am

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ iwyu: ${addsuffix .iwyuout, ${pkg_headers} ${extra_headers}}
2222

2323
%.iwyuout: %
2424
mkdir -p ${dir $@}
25-
${IWYU} ${IWYU_OPTS_CXX} ${CPPFLAGS} ${iwyu_CPPFLAGS} ${CXXFLAGS} $< 2> ${addsuffix .tmp, $@} || true
25+
${IWYU} ${IWYU_OPTS_C} ${CPPFLAGS} ${iwyu_CPPFLAGS} ${CFLAGS} $< 2> ${addsuffix .tmp, $@} || true
2626
mv -f ${addsuffix .tmp, $@} $@
2727

2828
.PHONY: clean-iwyu

library/json/c/include/tetengo/json/jsonParser.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#if !defined(TETENGO_JSON_JSONPARSER_H)
88
#define TETENGO_JSON_JSONPARSER_H
99

10+
#include <stdbool.h>
1011
#include <stddef.h>
1112

1213
#include <tetengo/json/element.h>
@@ -51,14 +52,14 @@ tetengo_json_jsonParser_t* tetengo_json_jsonParser_create(tetengo_json_reader_t*
5152
void tetengo_json_jsonParser_destroy(const tetengo_json_jsonParser_t* p_parser);
5253

5354
/*!
54-
\brief Returns non-zero when the next element exists.
55+
\brief Returns true when the next element exists.
5556
5657
\param p_parser A pointer to a perser.
5758
58-
\retval non-zero When the next element exists.
59-
\retval 0 Otherwise.
59+
\retval true When the next element exists.
60+
\retval false Otherwise.
6061
*/
61-
int tetengo_json_jsonParser_hasNext(const tetengo_json_jsonParser_t* p_parser);
62+
bool tetengo_json_jsonParser_hasNext(const tetengo_json_jsonParser_t* p_parser);
6263

6364
/*!
6465
\brief Returns the current element.

library/json/c/include/tetengo/json/reader.h

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#if !defined(TETENGO_JSON_READER_H)
88
#define TETENGO_JSON_READER_H
99

10+
#include <stdbool.h>
1011
#include <stddef.h>
1112

1213

@@ -93,24 +94,24 @@ void tetengo_json_reader_destroy(const tetengo_json_reader_t* p_reader);
9394
\param p_line_counting_reader A pointer to a line counting reader.
9495
\param p_location The storage for a location.
9596
96-
\retval non-zero When a location has been stored.
97-
\retval 0 When p_line_counting_reader is NULL or not a line counting reader.
98-
And/or when p_location is NULL.
99-
And/or when current position is beyond the termination point.
97+
\retval true When a location has been stored.
98+
\retval false When p_line_counting_reader is NULL or not a line counting reader.
99+
And/or when p_location is NULL.
100+
And/or when current position is beyond the termination point.
100101
*/
101-
int tetengo_json_reader_getLocation(
102+
bool tetengo_json_reader_getLocation(
102103
const tetengo_json_reader_t* p_line_counting_reader,
103104
tetengo_json_location_t* p_location);
104105

105106
/*!
106-
\brief Returns non-zero when the next character exists.
107+
\brief Returns true when the next character exists.
107108
108109
\param p_reader A pointer to a reader.
109110
110-
\retval non-zero When the next character exists.
111-
\retval 0 Otherwise.
111+
\retval true When the next character exists.
112+
\retval false Otherwise.
112113
*/
113-
int tetengo_json_reader_hasNext(const tetengo_json_reader_t* p_reader);
114+
bool tetengo_json_reader_hasNext(const tetengo_json_reader_t* p_reader);
114115

115116
/*!
116117
\brief Returns the current character.

library/json/c/src/tetengo_json_jsonParser.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ void tetengo_json_jsonParser_destroy(const tetengo_json_jsonParser_t* const p_pa
8585
{}
8686
}
8787

88-
int tetengo_json_jsonParser_hasNext(const tetengo_json_jsonParser_t* const p_parser)
88+
bool tetengo_json_jsonParser_hasNext(const tetengo_json_jsonParser_t* const p_parser)
8989
{
9090
try
9191
{
@@ -94,11 +94,11 @@ int tetengo_json_jsonParser_hasNext(const tetengo_json_jsonParser_t* const p_par
9494
throw std::invalid_argument{ "p_parser is NULL." };
9595
}
9696

97-
return p_parser->p_cpp_parser->has_next() ? 1 : 0;
97+
return p_parser->p_cpp_parser->has_next();
9898
}
9999
catch (...)
100100
{
101-
return 0;
101+
return false;
102102
}
103103
}
104104

library/json/c/src/tetengo_json_reader.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ void tetengo_json_reader_destroy(const tetengo_json_reader_t* const p_reader)
131131
{}
132132
}
133133

134-
int tetengo_json_reader_getLocation(
134+
bool tetengo_json_reader_getLocation(
135135
const tetengo_json_reader_t* const p_line_counting_reader,
136136
tetengo_json_location_t* const p_location)
137137
{
@@ -159,15 +159,15 @@ int tetengo_json_reader_getLocation(
159159
p_location->line_index = cpp_location.line_index();
160160
p_location->column_index = cpp_location.column_index();
161161

162-
return 1;
162+
return true;
163163
}
164164
catch (...)
165165
{
166-
return 0;
166+
return false;
167167
}
168168
}
169169

170-
int tetengo_json_reader_hasNext(const tetengo_json_reader_t* const p_reader)
170+
bool tetengo_json_reader_hasNext(const tetengo_json_reader_t* const p_reader)
171171
{
172172
try
173173
{
@@ -176,11 +176,11 @@ int tetengo_json_reader_hasNext(const tetengo_json_reader_t* const p_reader)
176176
throw std::invalid_argument{ "p_reader is NULL." };
177177
}
178178

179-
return p_reader->cpp_reader().has_next() ? 1 : 0;
179+
return p_reader->cpp_reader().has_next();
180180
}
181181
catch (...)
182182
{
183-
return 0;
183+
return false;
184184
}
185185
}
186186

library/json/test/src/Makefile.am

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,19 @@ IWYU_OPTS_CXX += -Xiwyu --mapping_file=${top_srcdir}/${IWYU_IMP_PATH}
4242

4343
iwyu: ${addsuffix .iwyuout, ${headers} ${sources}}
4444

45-
%.iwyuout: %
45+
%.c.iwyuout: %.c
46+
${IWYU} ${IWYU_OPTS_C} ${CPPFLAGS} ${test_tetengo_json_CPPFLAGS} ${CFLAGS} $< 2> ${addsuffix .tmp, $@} || true
47+
mv -f ${addsuffix .tmp, $@} $@
48+
49+
%.h.iwyuout: %.h
50+
${IWYU} ${IWYU_OPTS_C} ${CPPFLAGS} ${test_tetengo_json_CPPFLAGS} ${CFLAGS} $< 2> ${addsuffix .tmp, $@} || true
51+
mv -f ${addsuffix .tmp, $@} $@
52+
53+
%.cpp.iwyuout: %.cpp
54+
${IWYU} ${IWYU_OPTS_CXX} ${CPPFLAGS} ${test_tetengo_json_CPPFLAGS} ${CXXFLAGS} $< 2> ${addsuffix .tmp, $@} || true
55+
mv -f ${addsuffix .tmp, $@} $@
56+
57+
%.hpp.iwyuout: %.hpp
4658
${IWYU} ${IWYU_OPTS_CXX} ${CPPFLAGS} ${test_tetengo_json_CPPFLAGS} ${CXXFLAGS} $< 2> ${addsuffix .tmp, $@} || true
4759
mv -f ${addsuffix .tmp, $@} $@
4860

0 commit comments

Comments
 (0)