(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
analyzer/
malloc-macro-inline-events.c
       1  /* Test path-printing in the face of macros.  */
       2  
       3  /* { dg-additional-options "-fdiagnostics-show-line-numbers -fdiagnostics-path-format=inline-events -fdiagnostics-show-caret" } */
       4  /* { dg-enable-nn-line-numbers "" } */
       5  
       6  #include "malloc-macro.h"
       7  
       8  /* { dg-warning "double-'free' of 'ptr'" "" { target *-*-* } 2 } */
       9  
      10  int test (void *ptr)
      11  {
      12    WRAPPED_FREE (ptr); /* { dg-message "in expansion of macro 'WRAPPED_FREE'" } */
      13    WRAPPED_FREE (ptr); /* { dg-message "in expansion of macro 'WRAPPED_FREE'" } */
      14  
      15    /* Erase the spans indicating the header file
      16       (to avoid embedding path assumptions).  */
      17    /* { dg-regexp "\[^|\]+/malloc-macro.h:\[0-9\]+:\[0-9\]+:" } */
      18    /* { dg-regexp "\[^|\]+/malloc-macro.h:\[0-9\]+:\[0-9\]+:" } */
      19  
      20    /* { dg-begin-multiline-output "" }
      21     NN | #define WRAPPED_FREE(PTR) free(PTR)
      22        |                           ^~~~~~~~~
      23     NN |   WRAPPED_FREE (ptr);
      24        |   ^~~~~~~~~~~~
      25    'test': event 1
      26      |
      27      |
      28      |   NN | #define WRAPPED_FREE(PTR) free(PTR)
      29      |      |                           ^~~~~~~~~
      30      |      |                           |
      31      |      |                           (1) first 'free' here
      32      |   NN |   WRAPPED_FREE (ptr);
      33      |      |   ^~~~~~~~~~~~
      34      |
      35    'test': event 2
      36      |
      37      |
      38      |   NN | #define WRAPPED_FREE(PTR) free(PTR)
      39      |      |                           ^~~~~~~~~
      40      |      |                           |
      41      |      |                           (2) second 'free' here; first 'free' was at (1)
      42      |   NN |   WRAPPED_FREE (ptr);
      43      |      |   ^~~~~~~~~~~~
      44      |
      45       { dg-end-multiline-output "" } */
      46  }