• D
    Prevent more compiler optimization of mockable functions · e4b980c8
    Daniel P. Berrange 提交于
    Currently all mockable functions are annotated with the 'noinline'
    attribute. This is insufficient to guarantee that a function can
    be reliably mocked with an LD_PRELOAD. The C language spec allows
    the compiler to assume there is only a single implementation of
    each function. It can thus do things like propagating constant
    return values into the caller at compile time, or creating
    multiple specialized copies of the function body each optimized
    for a different caller. To prevent these optimizations we must
    also set the 'noclone' and 'weak' attributes.
    
    This fixes the test suite when libvirt.so is built with CLang
    with optimization enabled.
    Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
    e4b980c8
virnetsocket.h 6.9 KB