>From the GCC manual.  It's not clear why we want this hyper-specific flag
as standard for ODP.  It seems counterproductive.  Whether or not ISO C
ignores const return types, we're using them as the language intends.

-Wignored-qualifiers (C and C++ only)Warn if the return type of a function
has a type qualifier such as const. For ISO C such a type qualifier has no
effect, since the value returned by a function is not an lvalue. For C++,
the warning is only emitted for scalar types or void. ISO C prohibits
qualified void return types on function definitions, so such return types
always receive a warning even without this option.

This warning is also enabled by -Wextra.




On Mon, Sep 14, 2015 at 9:23 AM, Savolainen, Petri (Nokia - FI/Espoo) <
[email protected]> wrote:

>
>
>
>
> *From:* EXT Bill Fischofer [mailto:[email protected]]
> *Sent:* Friday, September 11, 2015 6:50 PM
> *To:* Savolainen, Petri (Nokia - FI/Espoo)
> *Cc:* LNG ODP Mailman List
> *Subject:* Re: [lng-odp] [API-NEXT PATCH v2 2/3] api: thread: added
> thread count max
>
>
>
>
>
>
>
> On Fri, Sep 11, 2015 at 7:55 AM, Petri Savolainen <
> [email protected]> wrote:
>
> Maximum thread count is needed for preparation to remove
> ODP_CONFIG_MAX_THREADS. It can be used e.g. to allocate
> resources per thread ID. Thread IDs range from 0 to
> count_max - 1.
>
> Signed-off-by: Petri Savolainen <[email protected]>
> ---
>  include/odp/api/thread.h            | 14 ++++++++++++--
>  platform/linux-generic/odp_thread.c |  5 +++++
>  2 files changed, 17 insertions(+), 2 deletions(-)
>
> diff --git a/include/odp/api/thread.h b/include/odp/api/thread.h
> index 89eae2b..746a830 100644
> --- a/include/odp/api/thread.h
> +++ b/include/odp/api/thread.h
> @@ -54,7 +54,7 @@ typedef enum odp_thread_type_e {
>   * Get thread identifier
>   *
>   * Returns the thread identifier of the current thread. Thread ids range
> from 0
> - * to ODP_CONFIG_MAX_THREADS-1. The ODP thread id is assinged by
> + * to odp_thread_count_max() - 1. The ODP thread id is assinged by
>   * odp_init_local() and freed by odp_term_local(). Thread id is unique
> within
>   * the ODP instance.
>   *
> @@ -68,13 +68,23 @@ int odp_thread_id(void);
>   * Returns the current ODP thread count. This is the number of active
> threads
>   * running the ODP instance. Each odp_init_local() call increments and
> each
>   * odp_term_local() call decrements the count. The count is always
> between 1 and
> - * ODP_CONFIG_MAX_THREADS.
> + * odp_thread_count_max().
>   *
>   * @return Current thread count
>   */
>  int odp_thread_count(void);
>
>  /**
> + * Maximum thread count
> + *
> + * Returns the maximum thread count, which is a constant value and set in
> + * ODP initialization phase.
> + *
> + * @return Maximum thread count
> + */
> +int odp_thread_count_max(void);
>
>
>
> Should be:
>
> const int odp_thread_count_max(void);
>
>
>
> Since these are implementation-defined constants that are being returned.
>
>
>
>
>
> In file included from ./include/odp/thread.h:28:0,
>
>                  from ./include/odp_buffer_internal.h:30,
>
>                  from ./include/odp_pool_internal.h:25,
>
>                  from odp_buffer.c:8:
>
> ../../include/odp/api/thread.h:85:11: error: type qualifiers ignored on
> function return type [-Werror=ignored-qualifiers]
>
> const int odp_thread_count_max(void);
>
>
>
>
>
> It fails to build with our compiler warning level. Compiler seems to
> ignore const as function return type qualifier.
>
>
>
> -Petri
>
>
>
>
>
>
>
> +
> +/**
>   * Thread type
>   *
>   * Returns the thread type of the current thread.
> diff --git a/platform/linux-generic/odp_thread.c
> b/platform/linux-generic/odp_thread.c
> index 770c64e..a8ce133 100644
> --- a/platform/linux-generic/odp_thread.c
> +++ b/platform/linux-generic/odp_thread.c
> @@ -204,6 +204,11 @@ int odp_thread_count(void)
>         return thread_globals->num;
>  }
>
> +int odp_thread_count_max(void)
>
> const int odp_thread_count_max(void)
>
> +{
> +       return __ODP_CONFIG_MAX_THREADS;
> +}
> +
>  odp_thread_type_t odp_thread_type(void)
>  {
>         return this_thread->type;
> --
> 2.5.1
>
> _______________________________________________
> lng-odp mailing list
> [email protected]
> https://lists.linaro.org/mailman/listinfo/lng-odp
>
>
>
_______________________________________________
lng-odp mailing list
[email protected]
https://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to