diff mbox

[PATCHv2] Add autoconf for --enable-allow-unimplemented (default is no)

Message ID 1415402231-7353-1-git-send-email-bill.fischofer@linaro.org
State New
Headers show

Commit Message

Bill Fischofer Nov. 7, 2014, 11:17 p.m. UTC
Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>
---
 configure.ac                                        | 11 +++++++++++
 platform/linux-generic/include/odp_debug_internal.h | 11 +++++++++--
 2 files changed, 20 insertions(+), 2 deletions(-)

Comments

Taras Kondratiuk Nov. 10, 2014, 8:22 a.m. UTC | #1
On 11/08/2014 01:17 AM, Bill Fischofer wrote:
> Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>
> ---
>   configure.ac                                        | 11 +++++++++++
>   platform/linux-generic/include/odp_debug_internal.h | 11 +++++++++--
>   2 files changed, 20 insertions(+), 2 deletions(-)
>
> diff --git a/configure.ac b/configure.ac
> index 1c061e9..cca76bb 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -110,6 +110,17 @@ AC_ARG_ENABLE([debug],
>   ODP_CFLAGS="$ODP_CFLAGS -DODP_DEBUG=$ODP_DEBUG"
>
>   ##########################################################################
> +# Enable/disable ODP_ALLOW_UNIMPLEMENTED
> +##########################################################################
> +ODP_ALLOW_UNIMPLEMENTED=0
> +AC_ARG_ENABLE([allow-unimplemented],
> +    [  --enable-allow-unimplemented  Enable/disable allow unimplemented],

--enable-allow-unimplemented looks a bit redundant.
Maybe --odp-allow-unimplemented ?

> +    [if test "x$enableval" = "xyes"; then
> +        ODP_ALLOW_UNIMPLEMENTED=1
> +    fi])
> +ODP_CFLAGS="$ODP_CFLAGS -DODP_ALLOW_UNIMPLEMENTED=$ODP_ALLOW_UNIMPLEMENTED"
> +
> +##########################################################################
>   # Check for pthreads availability
>   ##########################################################################
>
> diff --git a/platform/linux-generic/include/odp_debug_internal.h b/platform/linux-generic/include/odp_debug_internal.h
> index a87552f..b82ead4 100644
> --- a/platform/linux-generic/include/odp_debug_internal.h
> +++ b/platform/linux-generic/include/odp_debug_internal.h
> @@ -25,8 +25,15 @@ extern "C" {
>   /**
>    * This macro is used to indicate when a given function is not implemented
>    */
> -#define ODP_UNIMPLEMENTED(fmt, ...) \
> -		ODP_LOG(ODP_LOG_UNIMPLEMENTED, fmt, ##__VA_ARGS__)
> +#if ODP_ALLOW_UNIMPLEMENTED
> +#define ODP_UNIMPLEMENTED(fmt, ...)				        \
> +	ODP_LOG(ODP_LOG_UNIMPLEMENTED, fmt, ##__VA_ARGS__);
> +#else
> +#define ODP_UNIMPLEMENTED(fmt, ...) do {                                \
> +		ODP_LOG(ODP_LOG_UNIMPLEMENTED, fmt, ##__VA_ARGS__);	\
> +		odp_unimplemented();					\

This branch will fail to build, so ODP_LOG won't be executed anyway and
can be dropped.

> +	} while (0)
> +#endif
>
>   #ifdef __cplusplus
>   }
>
Taras Kondratiuk Nov. 10, 2014, 8:28 a.m. UTC | #2
On 11/10/2014 10:22 AM, Taras Kondratiuk wrote:
> On 11/08/2014 01:17 AM, Bill Fischofer wrote:
>> Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>
>> ---
>>   configure.ac                                        | 11 +++++++++++
>>   platform/linux-generic/include/odp_debug_internal.h | 11 +++++++++--
>>   2 files changed, 20 insertions(+), 2 deletions(-)
>>
>> diff --git a/configure.ac b/configure.ac
>> index 1c061e9..cca76bb 100644
>> --- a/configure.ac
>> +++ b/configure.ac
>> @@ -110,6 +110,17 @@ AC_ARG_ENABLE([debug],
>>   ODP_CFLAGS="$ODP_CFLAGS -DODP_DEBUG=$ODP_DEBUG"
>>
>>
>> ##########################################################################
>>
>> +# Enable/disable ODP_ALLOW_UNIMPLEMENTED
>> +##########################################################################
>>
>> +ODP_ALLOW_UNIMPLEMENTED=0
>> +AC_ARG_ENABLE([allow-unimplemented],
>> +    [  --enable-allow-unimplemented  Enable/disable allow
>> unimplemented],
>
> --enable-allow-unimplemented looks a bit redundant.
> Maybe --odp-allow-unimplemented ?

Please ignore this comment. Just noticed that '--enable-' part is needed
for AC_ARG_ENABLE.
diff mbox

Patch

diff --git a/configure.ac b/configure.ac
index 1c061e9..cca76bb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -110,6 +110,17 @@  AC_ARG_ENABLE([debug],
 ODP_CFLAGS="$ODP_CFLAGS -DODP_DEBUG=$ODP_DEBUG"
 
 ##########################################################################
+# Enable/disable ODP_ALLOW_UNIMPLEMENTED
+##########################################################################
+ODP_ALLOW_UNIMPLEMENTED=0
+AC_ARG_ENABLE([allow-unimplemented],
+    [  --enable-allow-unimplemented  Enable/disable allow unimplemented],
+    [if test "x$enableval" = "xyes"; then
+        ODP_ALLOW_UNIMPLEMENTED=1
+    fi])
+ODP_CFLAGS="$ODP_CFLAGS -DODP_ALLOW_UNIMPLEMENTED=$ODP_ALLOW_UNIMPLEMENTED"
+
+##########################################################################
 # Check for pthreads availability
 ##########################################################################
 
diff --git a/platform/linux-generic/include/odp_debug_internal.h b/platform/linux-generic/include/odp_debug_internal.h
index a87552f..b82ead4 100644
--- a/platform/linux-generic/include/odp_debug_internal.h
+++ b/platform/linux-generic/include/odp_debug_internal.h
@@ -25,8 +25,15 @@  extern "C" {
 /**
  * This macro is used to indicate when a given function is not implemented
  */
-#define ODP_UNIMPLEMENTED(fmt, ...) \
-		ODP_LOG(ODP_LOG_UNIMPLEMENTED, fmt, ##__VA_ARGS__)
+#if ODP_ALLOW_UNIMPLEMENTED
+#define ODP_UNIMPLEMENTED(fmt, ...)				        \
+	ODP_LOG(ODP_LOG_UNIMPLEMENTED, fmt, ##__VA_ARGS__);
+#else
+#define ODP_UNIMPLEMENTED(fmt, ...) do {                                \
+		ODP_LOG(ODP_LOG_UNIMPLEMENTED, fmt, ##__VA_ARGS__);	\
+		odp_unimplemented();					\
+	} while (0)
+#endif
 
 #ifdef __cplusplus
 }