diff mbox

[5/6] linux-user/main.c: Mark end_exclusive() as possibly unused

Message ID 1420719588-8138-6-git-send-email-peter.maydell@linaro.org
State New
Headers show

Commit Message

Peter Maydell Jan. 8, 2015, 12:19 p.m. UTC
The function end_exclusive() isn't used on all targets; mark it as
such to avoid a clang warning.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 linux-user/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Thomas Huth Jan. 21, 2015, 8:40 a.m. UTC | #1
On Thu,  8 Jan 2015 12:19:47 +0000
Peter Maydell <peter.maydell@linaro.org> wrote:

> The function end_exclusive() isn't used on all targets; mark it as
> such to avoid a clang warning.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>  linux-user/main.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/linux-user/main.c b/linux-user/main.c
> index bbd1cfd..0fda51c 100644
> --- a/linux-user/main.c
> +++ b/linux-user/main.c
> @@ -169,7 +169,7 @@ static inline void start_exclusive(void)
>  }
> 
>  /* Finish an exclusive operation.  */
> -static inline void end_exclusive(void)
> +static inline void __attribute__((unused)) end_exclusive(void)
>  {
>      pending_cpus = 0;
>      pthread_cond_broadcast(&exclusive_resume);

IMHO it might be better to add a proper #ifdef guard around that
function. Consider that the calls to end_exclusive() might get removed
completely one day, then you won't get a compiler warning about the
unused function anymore if you used the attribute__((unused)) way.

 Thomas
Peter Maydell Jan. 21, 2015, 10:54 a.m. UTC | #2
On 21 January 2015 at 08:40, Thomas Huth <thuth@linux.vnet.ibm.com> wrote:
> IMHO it might be better to add a proper #ifdef guard around that
> function. Consider that the calls to end_exclusive() might get removed
> completely one day, then you won't get a compiler warning about the
> unused function anymore if you used the attribute__((unused)) way.

Too painful, and these functions are likely going to go away/change
with the multithreaded-system-emulation support (I hope).

-- PMM
diff mbox

Patch

diff --git a/linux-user/main.c b/linux-user/main.c
index bbd1cfd..0fda51c 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -169,7 +169,7 @@  static inline void start_exclusive(void)
 }
 
 /* Finish an exclusive operation.  */
-static inline void end_exclusive(void)
+static inline void __attribute__((unused)) end_exclusive(void)
 {
     pending_cpus = 0;
     pthread_cond_broadcast(&exclusive_resume);