Re: bug: undefined reference to `cache_error' when running make after CFLAGS='-DNDEBUG' ./configure

2021-06-29 Thread dormando
Hey,

I'm not going to fix this one I think; testapp needs to be built without
NDEBUG. You shouldn't be passing that flag in; the build system makes the
main memcached binary with NDEBUG already.

On Wed, 23 Jun 2021, 張俊芝 wrote:

>
> Version: 1.6.9
>
> Steps to reproduce the bug:
>
>   Run the following commands:
>     CFLAGS='-DNDEBUG' ./configure
>     make
>
>   When compiling testapp.c, the error of undefined reference to `cache_error' 
> would happen.
>
> Path that fixes the bug:
> @@ -1,5 +1,8 @@
>  /* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
> +#ifdef NDEBUG
>  #undef NDEBUG
> +#define PRODUCT_BUILT_WITH_NDEBUG
> +#endif
>  #include 
>  #include 
>  #include 
> @@ -236,12 +239,16 @@
>  char old = *(p - 1);
>  *(p - 1) = 0;
>  cache_free(cache, p);
> +    #ifndef PRODUCT_BUILT_WITH_NDEBUG
>  assert(cache_error == -1);
> +    #endif
>  *(p - 1) = old;
>  
>  p[sizeof(uint32_t)] = 0;
>  cache_free(cache, p);
> +    #ifndef PRODUCT_BUILT_WITH_NDEBUG
>  assert(cache_error == 1);
> +    #endif
>  
>  /* restore signal handler */
>  sigaction(SIGABRT, _action, NULL);
>
> --
>
> ---
> You received this message because you are subscribed to the Google Groups 
> "memcached" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to memcached+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/memcached/cd5e8bd8-af2d-429a-af97-1e66a964ee91n%40googlegroups.com.
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"memcached" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to memcached+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/memcached/c7bd5228-bf41-465a-145-4e3a7beeeda1%40rydia.net.


bug: undefined reference to `cache_error' when running make after CFLAGS='-DNDEBUG' ./configure

2021-06-24 Thread 張俊芝

Version: 1.6.9

Steps to reproduce the bug:

  Run the following commands:
CFLAGS='-DNDEBUG' ./configure
make

  When compiling testapp.c, the error of undefined reference to 
`cache_error' would happen.

Path that fixes the bug:
@@ -1,5 +1,8 @@
 /* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- 
*/
+#ifdef NDEBUG
 #undef NDEBUG
+#define PRODUCT_BUILT_WITH_NDEBUG
+#endif
 #include 
 #include 
 #include 
@@ -236,12 +239,16 @@
 char old = *(p - 1);
 *(p - 1) = 0;
 cache_free(cache, p);
+#ifndef PRODUCT_BUILT_WITH_NDEBUG
 assert(cache_error == -1);
+#endif
 *(p - 1) = old;
 
 p[sizeof(uint32_t)] = 0;
 cache_free(cache, p);
+#ifndef PRODUCT_BUILT_WITH_NDEBUG
 assert(cache_error == 1);
+#endif
 
 /* restore signal handler */
 sigaction(SIGABRT, _action, NULL);

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"memcached" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to memcached+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/memcached/cd5e8bd8-af2d-429a-af97-1e66a964ee91n%40googlegroups.com.