]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Disable caller graphs for (some) functions with many callers (#4919)
authorJames Jones <jejones3141@gmail.com>
Mon, 20 Mar 2023 23:31:46 +0000 (18:31 -0500)
committerGitHub <noreply@github.com>
Mon, 20 Mar 2023 23:31:46 +0000 (16:31 -0700)
It turns out that one has to specify @hidecallergraph twice for
non-static functions: once where it's declared in a header and
once where it's defined. This doesn't catch everything; there's
still the matter of

1. Library functions. According to the doxygen-user mailing list,
   doxygen won't make *call* graphs for library functions... but
   what causes it to generate *caller* graphs for library functions,
   and if it does, why isn't it complaining about fprintf(), which
   FreeRADIUS code calls far more than fifty times?

2. xlat_init() and strlcpy(). (On Ubuntu, and probably other Linuxes,
   strlcpy() is in an optional libbsd package, and configure
   understandably doesn't check for that--hence we get the "missing"
   version.) For some still-unknown reason, two @hidecallergraphs
   doesn't do the trick.

doc/doxygen/Doxyfile
src/lib/util/dcursor_tests.c
src/lib/util/dlist.h
src/lib/util/minmax_heap.c
src/lib/util/pair.c
src/lib/util/pair.h
src/lib/util/rand.c
src/lib/util/rand.h
src/lib/util/time.h
src/lib/util/types.h
src/lib/util/value.h

index 7d7d152d504af9b52a85e69e63a5a79f65fd84b7..15bac2a4c627c01d1aa2047687b3418955ac7f00 100644 (file)
@@ -2150,7 +2150,11 @@ PREDEFINED             = WITH_STATS \
 # definition found in the source code.
 # This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
 
-EXPAND_AS_DEFINED      = FR_DLIST_HEAD
+EXPAND_AS_DEFINED      = FR_DLIST_HEAD \
+                         fr_dbuff_set \
+                         FR_SBUFF_SET_RETURN \
+                         MEM \
+                         fr_assert
 
 # If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will
 # remove all references to function-like macros that are alone on a line, have
index 4b4415f70b60566a9ba34ea6302a311c9bf1fd5f..d2c4827ce4b8acab933dbbbe83cae15aa55a974f 100644 (file)
@@ -16,6 +16,7 @@ static void *test_iter(fr_dlist_head_t *list, void *current, UNUSED void *uctx)
        return fr_dlist_next(list, current);
 }
 
+/** @hidecallergraph */
 static void test_list_init(test_item_list_t *list)
 {
        fr_dlist_talloc_init(&list->head, test_item_t, entry);
index 8f7253866e3948addd774fe51f49d9d8a2c30bf5..a88763960e45b971937ae36debdb0c11b218e6e3 100644 (file)
@@ -352,6 +352,8 @@ static inline CC_HINT(nonnull) int fr_dlist_insert_head(fr_dlist_head_t *list_he
  * @return
  *     - 0 on success.
  *     - -1 on failure.
+ *
+ * @hidecallergraph
  */
 static inline CC_HINT(nonnull) int fr_dlist_insert_tail(fr_dlist_head_t *list_head, void *ptr)
 {
@@ -458,6 +460,8 @@ static inline CC_HINT(nonnull(1,3)) int fr_dlist_insert_before(fr_dlist_head_t *
  * @return
  *     - The HEAD item.
  *     - NULL if no items exist in the list.
+ *
+ * @hidecallergraph
  */
 static inline CC_HINT(nonnull) void *fr_dlist_head(fr_dlist_head_t const *list_head)
 {
@@ -526,6 +530,7 @@ static inline CC_HINT(nonnull) void *fr_dlist_tail(fr_dlist_head_t const *list_h
  *     - The next item in the list if ptr is not NULL.
  *     - The head of the list if ptr is NULL.
  *     - NULL if ptr is the tail of the list (no more items).
+ * @hidecallergraph
  */
 static inline CC_HINT(nonnull(1)) void *fr_dlist_next(fr_dlist_head_t const *list_head, void const *ptr)
 {
@@ -607,6 +612,8 @@ static inline CC_HINT(nonnull(1)) void *fr_dlist_prev(fr_dlist_head_t const *lis
  * @return
  *     - The previous item in the list (makes iteration easier).
  *     - NULL if we just removed the head of the list.
+ *
+ * @hidecallergraph
  */
 static inline CC_HINT(nonnull(1)) void *fr_dlist_remove(fr_dlist_head_t *list_head, void *ptr)
 {
index e6fe0ad821e841652ff2c84dc9b3499e98c5bba1..3509ca05b93bef0ba4f0cb9ca3dadc949239aec9 100644 (file)
@@ -77,6 +77,9 @@ typedef struct fr_minmax_heap_s minmax_heap_t;
 #define HEAP_RIGHT(_x) (2 * (_x) + 1 )
 #define        HEAP_SWAP(_a, _b) { void *_tmp = _a; _a = _b; _b = _tmp; }
 
+/**
+ * @hidecallergraph
+ */
 static inline uint8_t depth(fr_minmax_heap_index_t i)
 {
        return fr_high_bit_pos(i) - 1;
index 51a62edce3049717d6a2d07135aff88546e0cde6..93070e1c687c9c36a037a0d325ee83bb6ee74629 100644 (file)
@@ -40,6 +40,8 @@ FR_TLIST_FUNCS(fr_pair_order_list, fr_pair_t, order_entry)
 /** Initialise a pair list header
  *
  * @param[in,out] list to initialise
+ *
+ * @hidecallergraph
  */
 void fr_pair_list_init(fr_pair_list_t *list)
 {
@@ -1259,6 +1261,8 @@ int fr_pair_prepend(fr_pair_list_t *list, fr_pair_t *to_add)
  * @return
  *     - 0 on success.
  *     - -1 on failure (pair already in list).
+ *
+ * @hidecallergraph
  */
 int fr_pair_append(fr_pair_list_t *list, fr_pair_t *to_add)
 {
index 443f46bbefc912c906378cc95887352967cc5fbe..fce2d9a49357c8cdc6ae87f90da63d9b72bc2e24 100644 (file)
@@ -89,7 +89,7 @@ struct value_pair_s {
                         * fr_value_box_t which gives us much greater packing efficiency.
                         */
                        uint8_t         pad[offsetof(fr_value_box_t, type) + sizeof(fr_type_t)];
-       
+
                        fr_pair_list_t  children;               //!< Nested attributes of this pair.
                };
        };
@@ -415,6 +415,7 @@ do { \
 } while (0)
 
 /* Initialisation */
+/** @hidecallergraph */
 void fr_pair_list_init(fr_pair_list_t *head) CC_HINT(nonnull);
 
 void fr_pair_init_null(fr_pair_t *vp) CC_HINT(nonnull);
@@ -454,6 +455,7 @@ bool                fr_pair_matches_da(void const *item, void const *uctx) CC_HINT(nonnull);
 unsigned int   fr_pair_count_by_da(fr_pair_list_t const *list, fr_dict_attr_t const *da)
                                    CC_HINT(nonnull);
 
+/** @hidecallergraph */
 fr_pair_t      *fr_pair_find_by_da(fr_pair_list_t const *list,
                                    fr_pair_t const *prev, fr_dict_attr_t const *da) CC_HINT(nonnull(1,3));
 
@@ -476,6 +478,7 @@ fr_pair_t   *fr_pair_find_by_child_num_idx(fr_pair_list_t const *list,
                                               fr_dict_attr_t const *parent, unsigned int attr,
                                               unsigned int idx) CC_HINT(nonnull);
 
+/** @hidecallergraph */
 int            fr_pair_append(fr_pair_list_t *list, fr_pair_t *vp) CC_HINT(nonnull);
 
 int            fr_pair_prepend(fr_pair_list_t *list, fr_pair_t *vp) CC_HINT(nonnull);
index 37293d429ea0fececfd676446ebf9f7558d462b4..bb3da950afd1012d6bccc01338c9c4eb5eb63309 100644 (file)
@@ -95,6 +95,7 @@ void fr_rand_seed(void const *data, size_t size)
 
 /** Return a 32-bit random number
  *
+ * @hidecallergraph
  */
 uint32_t fr_rand(void)
 {
index abd8170aa46d151997fca9774bc4177e4884b1ce..d9326dff41c5c832f59ff26c93d996adca2d1324 100644 (file)
@@ -57,6 +57,7 @@ typedef struct {
 
 void           fr_isaac(fr_randctx *ctx);
 void           fr_rand_init(fr_randctx *ctx, int flag);
+/** @hidecallergraph */
 uint32_t       fr_rand(void);  /* like rand(), but better. */
 void           fr_rand_buffer(void *start, size_t length) CC_HINT(nonnull);
 void           fr_rand_str(uint8_t *out, size_t len, char class);
index 7baaab5ac745cbcecf7bef331245283c268f5013..22766ce3f74ee0f24562fb5af4d6152a92340aab 100644 (file)
@@ -150,6 +150,7 @@ static inline int64_t fr_time_unwrap(fr_time_t time) { return time.value; } /* f
 #define fr_time_delta_max() (fr_time_delta_t){ .value = INT64_MAX }
 #define fr_time_delta_min() (fr_time_delta_t){ .value = INT64_MIN }
 #define fr_time_delta_wrap(_time) (fr_time_delta_t){ .value = (_time) }
+/** @hidecallergraph */
 static inline int64_t fr_time_delta_unwrap(fr_time_delta_t time) { return time.value; }        /* func to stop mixing with fr_time_t */
 #define fr_time_delta_overflow_add(_a, _b) (fr_time_overflow_ispos(_a, true, _b) ? fr_time_delta_max() : fr_time_delta_min())
 #define fr_time_delta_overflow_sub(_a, _b) (fr_time_overflow_ispos(_a, false, _b) ? fr_time_delta_max() : fr_time_delta_min())
@@ -583,6 +584,7 @@ static inline fr_time_delta_t fr_time_delta_from_csec(int64_t csec)
        return fr_time_delta_wrap(out);
 }
 
+/** @hidecallergraph */
 static inline fr_time_delta_t fr_time_delta_from_sec(int64_t sec)
 {
        int64_t out;
index 31b79b47c8f3b058e414ec1c36b0c6212ce37f1f..d7a8376c8d9f80849b6a68b3a4bc85d534a61b61 100644 (file)
@@ -366,6 +366,8 @@ extern size_t fr_type_table_len;
  *
  * @param[in] type to return name for.
  * @return name of the type
+ *
+ * @hidecallergraph
  */
 static inline char const *fr_type_to_str(fr_type_t type)
 {
index d82aac003b0ac0a0dd7bb376aba4b5c13b6350e2..ca06ca54dade1f9a7c038e1787a72dfdad95128b 100644 (file)
@@ -449,6 +449,8 @@ int         fr_value_box_steal(TALLOC_CTX *ctx, fr_value_box_t *dst, fr_value_box_t *sr
  * @param[in] type     to set.
  * @param[in] enumv    Enumeration values.
  * @param[in] tainted  Whether data will come from an untrusted source.
+ *
+ * @hidecallergraph
  */
 static inline CC_HINT(nonnull(1), always_inline)
 void fr_value_box_init(fr_value_box_t *vb, fr_type_t type, fr_dict_attr_t const *enumv, bool tainted)
@@ -535,6 +537,8 @@ fr_value_box_t *fr_value_box_alloc(TALLOC_CTX *ctx, fr_type_t type, fr_dict_attr
  * @return
  *     - A new fr_value_box_t.
  *     - NULL on error.
+ *
+ *  @hidecallergraph
  */
 static inline CC_HINT(always_inline)
 fr_value_box_t *fr_value_box_alloc_null(TALLOC_CTX *ctx)