diff mbox series

[liburing] sanitize: add ifdef guard around sanitizer functions

Message ID 20241003000209.1159551-1-dw@davidwei.uk (mailing list archive)
State New
Headers show
Series [liburing] sanitize: add ifdef guard around sanitizer functions | expand

Commit Message

David Wei Oct. 3, 2024, 12:02 a.m. UTC
Otherwise there are redefinition errors during compilation if
CONFIG_USE_SANITIZER isn't set.

Signed-off-by: David Wei <dw@davidwei.uk>
---
 src/sanitize.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Jens Axboe Oct. 3, 2024, 12:45 a.m. UTC | #1
On 10/2/24 6:02 PM, David Wei wrote:
> Otherwise there are redefinition errors during compilation if
> CONFIG_USE_SANITIZER isn't set.
> 
> Signed-off-by: David Wei <dw@davidwei.uk>
> ---
>  src/sanitize.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/src/sanitize.c b/src/sanitize.c
> index 46391a6..db5930d 100644
> --- a/src/sanitize.c
> +++ b/src/sanitize.c
> @@ -118,6 +118,7 @@ static inline void initialize_sanitize_handlers()
>  	sanitize_handlers_initialized = true;
>  }
>  
> +#if defined(CONFIG_USE_SANITIZER)
>  void liburing_sanitize_ring(struct io_uring *ring)
>  {
>  	struct io_uring_sq *sq = &ring->sq;
> @@ -174,3 +175,4 @@ void liburing_sanitize_iovecs(const struct iovec *iovecs, unsigned nr)
>  		}
>  	}
>  }
> +#endif

Hmm, but src/sanitize.o should not be built unless that is set. How is
this happening?
diff mbox series

Patch

diff --git a/src/sanitize.c b/src/sanitize.c
index 46391a6..db5930d 100644
--- a/src/sanitize.c
+++ b/src/sanitize.c
@@ -118,6 +118,7 @@  static inline void initialize_sanitize_handlers()
 	sanitize_handlers_initialized = true;
 }
 
+#if defined(CONFIG_USE_SANITIZER)
 void liburing_sanitize_ring(struct io_uring *ring)
 {
 	struct io_uring_sq *sq = &ring->sq;
@@ -174,3 +175,4 @@  void liburing_sanitize_iovecs(const struct iovec *iovecs, unsigned nr)
 		}
 	}
 }
+#endif