From 65b48c734c2efc1194e2cdec4469fd7d35043cf8 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Thu, 12 Mar 2020 19:36:15 +0900 Subject: [PATCH] [qfcc} Mark some more functions as pure I guess gcc doesn't consider recursive functions as pure, but marking get_type as pure had a slight ripple effect. --- tools/qfcc/include/expr.h | 4 ++-- tools/qfcc/source/switch.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/qfcc/include/expr.h b/tools/qfcc/include/expr.h index a8a1a98f2..d6b71d2b1 100644 --- a/tools/qfcc/include/expr.h +++ b/tools/qfcc/include/expr.h @@ -263,7 +263,7 @@ extern expr_t *local_expr; \return Pointer to the type description, or null if the expression type (expr_t::type) is inappropriate. */ -struct type_s *get_type (expr_t *e); +struct type_s *get_type (expr_t *e) __attribute__((pure)); /** Get the basic type code of the expression result. @@ -271,7 +271,7 @@ struct type_s *get_type (expr_t *e); \return Pointer to the type description, or ev_type_count if get_type() returns null. */ -etype_t extract_type (expr_t *e); +etype_t extract_type (expr_t *e) __attribute__((pure)); /** Create a new expression node. diff --git a/tools/qfcc/source/switch.c b/tools/qfcc/source/switch.c index 967a7b73f..6c00279a0 100644 --- a/tools/qfcc/source/switch.c +++ b/tools/qfcc/source/switch.c @@ -85,7 +85,7 @@ get_hash (const void *_cl, void *unused) return Hash_Buffer (&val->v, sizeof (val->v)) + val->lltype; } -static int +static int __attribute__((pure)) compare (const void *_cla, const void *_clb, void *unused) { case_label_t *cla = (case_label_t *) _cla;