1010#include  < stdint.h> 
1111#endif 
1212
13- #if  defined(__CLION_IDE__) && defined(__cplusplus)
14- /*  This code will only be seen by CLion's static analysis/preprocessing engine
15-  * and thus doesn't have to contain any definitions, declarations are 
16-  * sufficient. It mocks enough of the Doctest classes to make CLion's test 
17-  * framework support treat it as the full Doctest library. */  
18- namespace  doctest  {
19- namespace  detail  {
20- struct  TestSuite  {};
21- typedef  int  (*funcType)(const  uint8_t  *data, std::size_t  size);
22- struct  TestCase 
23- {
24-   TestCase (funcType test, const  char * file, unsigned  line, const  TestSuite& test_suite,
25-            const  char * type = " "  , int  template_id = -1 );
26-   TestCase& operator *(const  char * in);
27- };
28- int  regTest (const  TestCase& tc);
29- }
30- }
31- 
32- /*  This macro has to be defined or CLion will not show a play button, but the
33-  * value doesn't matter. */  
34- #define  DOCTEST_TEST_CASE 
35- 
36- #define  CLION_TEST_PLAY_BUTTON  \
37- /*  Silence a CLion warning about a static
38-  * initializer with static storage duration */    \
39- /*  NOLINTBEGIN(cert-err58-cpp) */                 \
40- static  const  int  DOCTEST_ANON_VAR_15771531 =    \
41-     doctest::detail::regTest (                   \
42-         doctest::detail::TestCase (              \
43-             &LLVMFuzzerTestOneInput,            \
44-             " "  ,                                 \
45-             1 ,                                  \
46-             doctest::detail::TestSuite ()        \
47- /*  This string is used as the test name and has
48-  * to be globally unique so that CLion 
49-  * generates a unique run configuration per 
50-  * test. */                                       \
51-         ) * CIFUZZ_TEST_NAME);                  \
52- /*  NOLINTEND(cert-err58-cpp) */ 
53- #else 
54- #define  CLION_TEST_PLAY_BUTTON 
55- #endif
56- 
5713#ifdef  __cplusplus
5814#define  CIFUZZ_C_LINKAGE  extern  " C" 
5915#else 
@@ -63,22 +19,28 @@ static const int DOCTEST_ANON_VAR_15771531 =    \
6319static  void  LLVMFuzzerTestOneInputNoReturn (const  uint8_t  *data, size_t  size);
6420
6521#ifdef  CIFUZZ_GCOV
66- CIFUZZ_C_LINKAGE void  __gcov_dump ();
67- CIFUZZ_C_LINKAGE void  __gcov_reset ();
68- CIFUZZ_C_LINKAGE int  LLVMFuzzerTestOneInput (const  uint8_t  *data, size_t  size) {
69-   LLVMFuzzerTestOneInputNoReturn (data, size);
70-   __gcov_dump ();
71-   __gcov_reset ();
72-   return  0 ;
73- }
22+ #define  DEFINE_LLVM_FUZZER_TEST_ONE_INPUT                                       \
23+   CIFUZZ_C_LINKAGE void  __gcov_dump ();                                         \
24+   CIFUZZ_C_LINKAGE void  __gcov_reset ();                                        \
25+   CIFUZZ_C_LINKAGE int  LLVMFuzzerTestOneInput (const  uint8_t  *data,             \
26+                                               size_t  size) {                   \
27+     LLVMFuzzerTestOneInputNoReturn (data, size);                                \
28+     __gcov_dump ();                                                             \
29+     __gcov_reset ();                                                            \
30+     return  0 ;                                                                  \
31+   }
7432#else 
75- CIFUZZ_C_LINKAGE int  LLVMFuzzerTestOneInput (const  uint8_t  *data, size_t  size) {
76-   LLVMFuzzerTestOneInputNoReturn (data, size);
77-   return  0 ;
78- }
33+ #define  DEFINE_LLVM_FUZZER_TEST_ONE_INPUT                                       \
34+   CIFUZZ_C_LINKAGE int  LLVMFuzzerTestOneInput (const  uint8_t  *data,             \
35+                                               size_t  size) {                   \
36+     LLVMFuzzerTestOneInputNoReturn (data, size);                                \
37+     return  0 ;                                                                  \
38+   }
7939#endif 
8040
81- #define  FUZZ_TEST  void  LLVMFuzzerTestOneInputNoReturn
41+ #define  FUZZ_TEST                                                               \
42+   DEFINE_LLVM_FUZZER_TEST_ONE_INPUT;                                           \
43+   void  LLVMFuzzerTestOneInputNoReturn
8244
8345#ifdef  __APPLE__
8446#define  DECLARE_LLVM_FUZZER_INITIALIZE_NO_RETURN                                \
0 commit comments