summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJohannes Bucher <johannes.bucher2@student.kit.edu>2019-01-24 15:02:02 +0100
committerJohannes Bucher <johannes.bucher2@student.kit.edu>2019-01-24 15:30:55 +0100
commitd9195f0ec27b4b01039e5ee787d751fd19271aa6 (patch)
tree571b9c80dd5a9320e3541896beb92701a213c8fa
parentbe2d414b59d30f0d38c83ebd6354782ae7c70016 (diff)
improved readability/code quality according to clang-tidy readability checks
resolved warnings for these checks: - readability-non-const-parameter - readability-avoid-const-params-in-decls - readability-named-parameter - readability-redundant-control-flow - misc-redundant-expression
-rw-r--r--src/ast/attribute.c1
-rw-r--r--src/ast/walk.c8
-rw-r--r--src/driver/driver.c2
-rw-r--r--src/firm/ast2firm.c4
-rw-r--r--src/parser/parser.c9
5 files changed, 11 insertions, 13 deletions
diff --git a/src/ast/attribute.c b/src/ast/attribute.c
index ef817a1..5897999 100644
--- a/src/ast/attribute.c
+++ b/src/ast/attribute.c
@@ -301,7 +301,6 @@ static void handle_attribute_asm(const attribute_t *attribute,
symbol_t *sym = symbol_table_insert(expression->string_literal.value->begin);
entity->function.actual_name = sym;
assert(argument->next == NULL);
- return;
}
static void handle_attribute_alias(const attribute_t *attribute,
diff --git a/src/ast/walk.c b/src/ast/walk.c
index ff16d6e..5320a8c 100644
--- a/src/ast/walk.c
+++ b/src/ast/walk.c
@@ -19,12 +19,12 @@ typedef struct walk_env_t {
void *env;
} walk_env_t;
-static void walk_expression(expression_t *expr, const walk_env_t *const env);
+static void walk_expression(expression_t *expr, const walk_env_t *env);
static void walk_statement(statement_t *stmt, const walk_env_t *env);
static void walk_entity(entity_t *entity, const walk_env_t *env);
-static void walk_designator(const designator_t *, const walk_env_t *);
-static void walk_initializer(const initializer_t *, const walk_env_t *);
-static void walk_scope(const scope_t *const scope, const walk_env_t *const env);
+static void walk_designator(const designator_t *designator, const walk_env_t *env);
+static void walk_initializer(const initializer_t *initializer, const walk_env_t *env);
+static void walk_scope(const scope_t *scope, const walk_env_t *env);
static void walk_type(type_t *const type, const walk_env_t *const env)
{
diff --git a/src/driver/driver.c b/src/driver/driver.c
index 639d8d4..4e8c843 100644
--- a/src/driver/driver.c
+++ b/src/driver/driver.c
@@ -318,8 +318,8 @@ compilation_unit_type_t autodetect_input(char const *const path)
streq(suffix, "h") ? COMPILATION_UNIT_C :
streq(suffix, "ir") ? COMPILATION_UNIT_IR :
streq(suffix, "o") ? COMPILATION_UNIT_OBJECT :
- streq(suffix, "s") ? COMPILATION_UNIT_PREPROCESSED_ASSEMBLER :
streq(suffix, "so") ? COMPILATION_UNIT_OBJECT :
+ streq(suffix, "s") ? COMPILATION_UNIT_PREPROCESSED_ASSEMBLER :
COMPILATION_UNIT_OBJECT; /* gcc behavior: unknown file extension means
object file */
}
diff --git a/src/firm/ast2firm.c b/src/firm/ast2firm.c
index 82afb3d..84b3637 100644
--- a/src/firm/ast2firm.c
+++ b/src/firm/ast2firm.c
@@ -2498,7 +2498,7 @@ incdec:
}
static void complex_equality_evaluation(const binary_expression_t *binexpr,
- jump_target *const true_target, jump_target *const false_target,
+ jump_target *true_target, jump_target *false_target,
ir_relation relation);
static complex_value complex_to_control_flow(const expression_t *expression,
@@ -3084,7 +3084,7 @@ static complex_value complex_conditional_to_firm(
return val;
}
-static void create_local_declarations(entity_t*);
+static void create_local_declarations(entity_t *first);
static complex_value compound_statement_to_firm_complex(
const compound_statement_t *compound)
diff --git a/src/parser/parser.c b/src/parser/parser.c
index 32aa597..e83e9d8 100644
--- a/src/parser/parser.c
+++ b/src/parser/parser.c
@@ -139,7 +139,7 @@ static unsigned short token_anchor_set[T_LAST_TOKEN];
static statement_t *parse_compound_statement(bool inside_expression_statement);
static statement_t *parse_statement(void);
-static expression_t *parse_subexpression(precedence_t);
+static expression_t *parse_subexpression(precedence_t precedence);
static expression_t *parse_expression(void);
static type_t *parse_typename(void);
static type_t *parse_non_empty_typename(void);
@@ -1418,8 +1418,7 @@ static attribute_t *parse_attributes(attribute_t *first)
#define ENT_ANY ((entity_t*)-1)
static void mark_vars_read(expression_t *expr, entity_t *lhs_ent);
-static entity_t *determine_lhs_ent(expression_t *const expr,
- entity_t *lhs_ent);
+static entity_t *determine_lhs_ent(expression_t *expr, entity_t *lhs_ent);
static designator_t *parse_designation(void)
{
@@ -4612,7 +4611,7 @@ static int determine_truth(expression_t const* const cond)
: -1;
}
-static void check_reachable(statement_t *);
+static void check_reachable(statement_t *stmt);
static bool reaches_end;
static bool expression_returns(expression_t const *const expr)
@@ -5146,7 +5145,7 @@ warn_unreachable:
}
}
-static void prepare_main_collect2(entity_t*);
+static void prepare_main_collect2(entity_t *entity);
static void parse_external_declaration(void)
{