Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't inline when compiling with Clang #44

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Commits on Jul 8, 2014

  1. Don't inline when compiling with Clang

    Clang has a different behaviour than GCC when it comes to inlining functions.
    Sadly Clang identifies itself as __GNUC__, hence the define to prevent non-GCC
    compilers to use the inline keyword didn't work.
    
    This commit solves the problem with adding an additional check to the define,
    that the compiler isn't Clang.
    
    During compilation you get warnings like:
    
        In file included from linux_sigar.c:30:
        ../../../include/sigar_util.h:80:20: warning: inline function 'sigar_skip_token' is not defined
              [-Wundefined-inline]
        SIGAR_INLINE char *sigar_skip_token(char *p);
                       ^
        linux_sigar.c:137:24: note: used here
                    if ((ptr = sigar_skip_token(ptr))) {
                               ^
    
    Which end up in an error like:
    
        libtool: link: clang -g -O2 -o .libs/cpuinfo cpuinfo.o  ../src/.libs/libsigar.so
        ../src/.libs/libsigar.so: undefined reference to `sigar_skip_token'
        clang: error: linker command failed with exit code 1 (use -v to see invocation)
    vmx committed Jul 8, 2014
    Configuration menu
    Copy the full SHA
    2c24d43 View commit details
    Browse the repository at this point in the history