Skip to content

Commit 1611c8c

Browse files
author
Luigi Cocozza
committed
[Lint] fix lint warnings
1 parent c7b29cb commit 1611c8c

File tree

19 files changed

+177
-174
lines changed

19 files changed

+177
-174
lines changed

.clang-tidy

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,25 @@ Checks: '
99
readability-*,
1010
-readability-magic-numbers,
1111
-readability-identifier-length,
12+
-readability-braces-around-statements,
1213
-readability-function-cognitive-complexity,
1314
-readability-avoid-nested-conditional-operator,
1415
-readability-non-const-parameter,
1516
-readability-implicit-bool-conversion,
1617
-readability-const-return-type,
1718
-readability-identifier-naming,
19+
-readability-suspicious-call-argument,
1820
-misc-const-correctness,
1921
-performance-unnecessary-value-param,
2022
-modernize-use-cxx-headers,
2123
-cert-err33-c,
24+
-cert-dcl37-c,
25+
-cert-dcl51-cpp,
2226
-clang-analyzer-unix.MallocSizeof,
2327
-bugprone-easily-swappable-parameters,
2428
-bugprone-narrowing-conversions,
2529
-bugprone-multi-level-implicit-pointer-conversion,
30+
-bugprone-reserved-identifier,
2631
-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling,
2732
-clang-analyzer-security.insecureAPI.strcpy,
2833
-clang-analyzer-optin.performance.Padding,

includes/argus/options.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,13 @@ ARGUS_API char *format_choices_validator(validator_data_t data);
8484
*/
8585
#define MAKE_VALIDATOR(fn, _formatter_, _data_, _order_) \
8686
&(validator_entry_t){ \
87-
.func = fn, \
88-
.formatter = _formatter_, \
89-
.data = _data_, \
90-
.order = _order_ \
87+
.func = (fn), \
88+
.formatter = (_formatter_), \
89+
.data = (_data_), \
90+
.order = (_order_) \
9191
}
9292
#define _V_DATA_RANGE_(_min_, _max_) \
93-
((validator_data_t){ .range = (argus_range_t){ .min = _min_, .max = _max_ } })
93+
((validator_data_t){ .range = (argus_range_t){ .min = (_min_), .max = (_max_) } })
9494
#define _V_DATA_CUSTOM_(data) \
9595
((validator_data_t){ .custom = (uintptr_t)(data) })
9696

source/api/argus_value_access.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
argus_value_t argus_get(argus_t *argus, const char *option_path)
1717
{
18-
argus->error_code = 0;
18+
argus->error_code = 0;
1919
argus_option_t *option = find_option_by_active_path(*argus, option_path);
2020
if (option == NULL) {
2121
argus->error_code = ARGUS_ERROR_NO_VALUE;
@@ -42,7 +42,7 @@ size_t argus_count(argus_t *argus, const char *option_path)
4242

4343
argus_value_t argus_array_get(argus_t *argus, const char *option_path, size_t index)
4444
{
45-
argus->error_code = 0;
45+
argus->error_code = 0;
4646
argus_option_t *option = find_option_by_active_path(*argus, option_path);
4747

4848
if (option == NULL) {
@@ -68,7 +68,7 @@ argus_value_t argus_array_get(argus_t *argus, const char *option_path, size_t in
6868

6969
argus_value_t argus_map_get(argus_t *argus, const char *option_path, const char *key)
7070
{
71-
argus->error_code = 0;
71+
argus->error_code = 0;
7272
argus_option_t *option = find_option_by_active_path(*argus, option_path);
7373

7474
if (option == NULL) {

source/callbacks/handlers/map_bool_handler.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#include <string.h>
1515

1616
#include "argus/errors.h"
17-
#include "argus/internal/compiler.h"
1817
#include "argus/internal/cross_platform.h"
1918
#include "argus/internal/utils.h"
2019
#include "argus/options.h"

source/callbacks/handlers/map_float_handler.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
#include <string.h>
1414

1515
#include "argus/errors.h"
16-
#include "argus/internal/compiler.h"
1716
#include "argus/internal/cross_platform.h"
1817
#include "argus/internal/utils.h"
1918
#include "argus/options.h"

source/callbacks/handlers/map_int_handler.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#include <string.h>
1515

1616
#include "argus/errors.h"
17-
#include "argus/internal/compiler.h"
1817
#include "argus/internal/cross_platform.h"
1918
#include "argus/internal/utils.h"
2019
#include "argus/options.h"

source/callbacks/handlers/map_string_handler.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
#include <string.h>
1414

1515
#include "argus/errors.h"
16-
#include "argus/internal/compiler.h"
1716
#include "argus/internal/cross_platform.h"
1817
#include "argus/internal/utils.h"
1918
#include "argus/options.h"

source/callbacks/validators/choices_validator.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
#include "argus/errors.h"
1616
#include "argus/internal/cross_platform.h"
17-
#include "argus/internal/utils.h"
1817
#include "argus/types.h"
1918

2019
// Forward declaration
@@ -97,10 +96,8 @@ char *format_choices_validator(validator_data_t data)
9796
total_length += strlen(choices->as_strings[i]);
9897
break;
9998
case VALUE_TYPE_INT:
100-
total_length += 20; // Max digits for int64_t
101-
break;
10299
case VALUE_TYPE_FLOAT:
103-
total_length += 20; // Max digits for double
100+
total_length += 20; // Max digits for int64_t/double
104101
break;
105102
default:
106103
break;

source/callbacks/validators/count_validator.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
*/
99

1010
#include <inttypes.h>
11+
#include <stdint.h>
1112
#include <stdio.h>
1213
#include <stdlib.h>
1314

source/callbacks/validators/length_validator.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
*/
99

1010
#include <inttypes.h>
11+
#include <stdint.h>
1112
#include <stdio.h>
1213
#include <stdlib.h>
1314
#include <string.h>

0 commit comments

Comments
 (0)