summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2021-06-19 15:48:15 -0400
committerGitHub <noreply@github.com>2021-06-19 15:48:15 -0400
commitf0d4336c1c818ec1f3e3709fab5badc161c835a3 (patch)
treee22f367cb7163672139c508d05819a555a619fbb
parent22f158c6ff1852336c1e8c148d87ba86329bfc5e (diff)
parent4133f94ba5f06ee960c9d510e3efa5fab8f10af1 (diff)
Merge pull request #8881 from FRRouting/mergify/bp/stable/7.4/pr-8876stable/7.4
lib: remove pure attribute from functions that modify memory (backport #8876)
-rw-r--r--lib/compiler.h9
-rw-r--r--lib/table.h44
2 files changed, 20 insertions, 33 deletions
diff --git a/lib/compiler.h b/lib/compiler.h
index 217a60d888..3326e8bd33 100644
--- a/lib/compiler.h
+++ b/lib/compiler.h
@@ -108,15 +108,6 @@ extern "C" {
#define assume(x)
#endif
-/* pure = function does not modify memory & return value is the same if
- * memory hasn't changed (=> allows compiler to optimize)
- *
- * Mostly autodetected by the compiler if function body is available (i.e.
- * static inline functions in headers). Since that implies it should only be
- * used in headers for non-inline functions, the "extern" is included here.
- */
-#define ext_pure extern __attribute__((pure))
-
/* for helper functions defined inside macros */
#define macro_inline static inline __attribute__((unused))
#define macro_pure static inline __attribute__((unused, pure))
diff --git a/lib/table.h b/lib/table.h
index 9cd9503376..2858784341 100644
--- a/lib/table.h
+++ b/lib/table.h
@@ -197,29 +197,25 @@ static inline void route_table_set_info(struct route_table *table, void *d)
table->info = d;
}
-/* ext_pure => extern __attribute__((pure))
- * does not modify memory (but depends on mem), allows compiler to optimize
- */
-
extern void route_table_finish(struct route_table *table);
-ext_pure struct route_node *route_top(struct route_table *table);
-ext_pure struct route_node *route_next(struct route_node *node);
-ext_pure struct route_node *route_next_until(struct route_node *node,
- const struct route_node *limit);
+extern struct route_node *route_top(struct route_table *table);
+extern struct route_node *route_next(struct route_node *node);
+extern struct route_node *route_next_until(struct route_node *node,
+ const struct route_node *limit);
extern struct route_node *route_node_get(struct route_table *table,
union prefixconstptr pu);
-ext_pure struct route_node *route_node_lookup(struct route_table *table,
- union prefixconstptr pu);
-ext_pure struct route_node *route_node_lookup_maynull(struct route_table *table,
- union prefixconstptr pu);
-ext_pure struct route_node *route_node_match(struct route_table *table,
- union prefixconstptr pu);
-ext_pure struct route_node *route_node_match_ipv4(struct route_table *table,
- const struct in_addr *addr);
-ext_pure struct route_node *route_node_match_ipv6(struct route_table *table,
- const struct in6_addr *addr);
-
-ext_pure unsigned long route_table_count(struct route_table *table);
+extern struct route_node *route_node_lookup(struct route_table *table,
+ union prefixconstptr pu);
+extern struct route_node *route_node_lookup_maynull(struct route_table *table,
+ union prefixconstptr pu);
+extern struct route_node *route_node_match(struct route_table *table,
+ union prefixconstptr pu);
+extern struct route_node *route_node_match_ipv4(struct route_table *table,
+ const struct in_addr *addr);
+extern struct route_node *route_node_match_ipv6(struct route_table *table,
+ const struct in6_addr *addr);
+
+extern unsigned long route_table_count(struct route_table *table);
extern struct route_node *route_node_create(route_table_delegate_t *delegate,
struct route_table *table);
@@ -228,10 +224,10 @@ extern void route_node_destroy(route_table_delegate_t *delegate,
struct route_table *table,
struct route_node *node);
-ext_pure struct route_node *route_table_get_next(struct route_table *table,
- union prefixconstptr pu);
-ext_pure int route_table_prefix_iter_cmp(const struct prefix *p1,
- const struct prefix *p2);
+extern struct route_node *route_table_get_next(struct route_table *table,
+ union prefixconstptr pu);
+extern int route_table_prefix_iter_cmp(const struct prefix *p1,
+ const struct prefix *p2);
/*
* Iterator functions.