Ver código fonte

Do not define fuzz function if fuzzing is not enabled.

Resolves unused function warnings.
Jason Valenzuela 4 anos atrás
pai
commit
4c9345bb26
1 arquivos alterados com 4 adições e 2 exclusões
  1. 4 2
      source/src/ports/POSIX/main.c

+ 4 - 2
source/src/ports/POSIX/main.c

@@ -55,7 +55,9 @@ static void *executeEventLoop(void *pthread_arg);
 /** @brief Fuzz TCP packets handling flow with AFL.
  *
  */
+#ifdef FUZZING_AFL
 static void fuzzHandlePacketFlow(void);
+#endif /* FUZZING_AFL */
 
 /*****************************************************************************/
 /** @brief Flag indicating if the stack should end its execution
@@ -265,8 +267,8 @@ static void *executeEventLoop(void *pthread_arg) {
   return &pthread_dummy_ret;
 }
 
-static void fuzzHandlePacketFlow(void) {
 #ifdef FUZZING_AFL
+static void fuzzHandlePacketFlow(void) {
   int socket_fd = 0;   // Fake socket fd
   uint8_t buff[512];   // Input buffer
   struct sockaddr_in from_address = { 0 }; // Fake socket address
@@ -293,5 +295,5 @@ static void fuzzHandlePacketFlow(void) {
                                                           &from_address,
                                                           &outgoing_message);
   }
-#endif
 }
+#endif /* FUZZING_AFL */