[libvirt] [PATCH] Do not inline virNumaNodeIsAvailable

Daniel P. Berrange berrange at redhat.com
Thu Mar 5 11:09:41 UTC 2015


On Thu, Mar 05, 2015 at 12:05:52PM +0100, Ján Tomko wrote:
> Explicitly request that virNumaNodeIsAvailable not be inlined.
> This fixes the test suite when building with clang (3.5.1).

Huh, so clang will inline functions, even if they are exported
in the .so library ?  Is there some clang compiler flag we can
use to stop that ?  I'd only expect it to inline stuff which
was declared static, or whose impl body was in the header file

> ---
> This only leaves the mysterious check-protocol failure.
> And too large stack frame size when building the tests with -O0.
> 
>  src/internal.h     | 10 ++++++++++
>  src/util/virnuma.h |  3 ++-
>  2 files changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/src/internal.h b/src/internal.h
> index 4d473af..84aa330 100644
> --- a/src/internal.h
> +++ b/src/internal.h
> @@ -139,6 +139,16 @@
>  #  endif
>  
>  /**
> + * ATTRIBUTE_NOINLINE:
> + *
> + * Macro to indicate a function that cannot be inlined
> + * (e.g. a function that is mocked in the test suite)
> + */
> +#  ifndef ATTRIBUTE_NOINLINE
> +#   define ATTRIBUTE_NOINLINE __attribute__((__noinline__))
> +#  endif
> +
> +/**
>   * ATTRIBUTE_SENTINEL:
>   *
>   * Macro to check for NULL-terminated varargs lists
> diff --git a/src/util/virnuma.h b/src/util/virnuma.h
> index 1f3c0ad..4ddcc5a 100644
> --- a/src/util/virnuma.h
> +++ b/src/util/virnuma.h
> @@ -37,7 +37,8 @@ virBitmapPtr virNumaGetHostNodeset(void);
>  bool virNumaNodesetIsAvailable(virBitmapPtr nodeset);
>  bool virNumaIsAvailable(void);
>  int virNumaGetMaxNode(void);
> -bool virNumaNodeIsAvailable(int node);
> +bool virNumaNodeIsAvailable(int node)
> +    ATTRIBUTE_NOINLINE;
>  int virNumaGetDistances(int node,
>                          int **distances,
>                          int *ndistances);

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list