OSX: fix compilation warnings #916

Closed
giampaolo opened this Issue Oct 11, 2016 · 0 comments

Comments

Projects
None yet
1 participant
@giampaolo
Owner

giampaolo commented Oct 11, 2016

I've just installed a most recent version of OSX (I was on 10.5) and there are a tons:

vagrant@osx/vagrant/psutil$ make clean build
rm -f `find . -type f -name \*.py[co]`
rm -f `find . -type f -name \*.so`
rm -f `find . -type f -name \*.~`
rm -f `find . -type f -name \*.orig`
rm -f `find . -type f -name \*.bak`
rm -f `find . -type f -name \*.rej`
rm -rf `find . -type d -name __pycache__`
rm -rf *.core
rm -rf *.egg-info
rm -rf *\estfile*
rm -rf .coverage
rm -rf .tox
rm -rf build/
rm -rf dist/
rm -rf docs/_build/
rm -rf htmlcov/
rm -rf tmp/
python setup.py build
running build
running build_py
creating build
creating build/lib.macosx-10.10-intel-2.7
creating build/lib.macosx-10.10-intel-2.7/psutil
copying psutil/_psposix.py -> build/lib.macosx-10.10-intel-2.7/psutil
copying psutil/_psbsd.py -> build/lib.macosx-10.10-intel-2.7/psutil
copying psutil/_pssunos.py -> build/lib.macosx-10.10-intel-2.7/psutil
copying psutil/_pslinux.py -> build/lib.macosx-10.10-intel-2.7/psutil
copying psutil/_common.py -> build/lib.macosx-10.10-intel-2.7/psutil
copying psutil/__init__.py -> build/lib.macosx-10.10-intel-2.7/psutil
copying psutil/_psosx.py -> build/lib.macosx-10.10-intel-2.7/psutil
copying psutil/_compat.py -> build/lib.macosx-10.10-intel-2.7/psutil
copying psutil/_pswindows.py -> build/lib.macosx-10.10-intel-2.7/psutil
creating build/lib.macosx-10.10-intel-2.7/psutil/tests
copying psutil/tests/test_bsd.py -> build/lib.macosx-10.10-intel-2.7/psutil/tests
copying psutil/tests/test_memory_leaks.py -> build/lib.macosx-10.10-intel-2.7/psutil/tests
copying psutil/tests/test_system.py -> build/lib.macosx-10.10-intel-2.7/psutil/tests
copying psutil/tests/test_linux.py -> build/lib.macosx-10.10-intel-2.7/psutil/tests
copying psutil/tests/test_misc.py -> build/lib.macosx-10.10-intel-2.7/psutil/tests
copying psutil/tests/__init__.py -> build/lib.macosx-10.10-intel-2.7/psutil/tests
copying psutil/tests/test_osx.py -> build/lib.macosx-10.10-intel-2.7/psutil/tests
copying psutil/tests/test_process.py -> build/lib.macosx-10.10-intel-2.7/psutil/tests
copying psutil/tests/test_windows.py -> build/lib.macosx-10.10-intel-2.7/psutil/tests
copying psutil/tests/runner.py -> build/lib.macosx-10.10-intel-2.7/psutil/tests
copying psutil/tests/test_posix.py -> build/lib.macosx-10.10-intel-2.7/psutil/tests
copying psutil/tests/test_sunos.py -> build/lib.macosx-10.10-intel-2.7/psutil/tests
running build_ext
building 'psutil._psutil_osx' extension
creating build/temp.macosx-10.10-intel-2.7
creating build/temp.macosx-10.10-intel-2.7/psutil
creating build/temp.macosx-10.10-intel-2.7/psutil/arch
creating build/temp.macosx-10.10-intel-2.7/psutil/arch/osx
cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -arch i386 -pipe -DPSUTIL_POSIX=1 -DPSUTIL_VERSION=440 -DPSUTIL_OSX=1 -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c psutil/_psutil_osx.c -o build/temp.macosx-10.10-intel-2.7/psutil/_psutil_osx.o
psutil/_psutil_osx.c:127:31: warning: implicit conversion loses integer precision: 'long' to 'pid_t' (aka 'int') [-Wshorten-64-to-32]
    if (psutil_get_kinfo_proc(pid, &kp) == -1)
        ~~~~~~~~~~~~~~~~~~~~~ ^~~
psutil/_psutil_osx.c:175:24: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
    ret = proc_pidpath(pid, &buf, sizeof(buf));
          ~~~~~~~~~~~~ ^~~
psutil/_psutil_osx.c:231:31: warning: implicit conversion loses integer precision: 'long' to 'pid_t' (aka 'int') [-Wshorten-64-to-32]
    if (psutil_get_kinfo_proc(pid, &kp) == -1)
        ~~~~~~~~~~~~~~~~~~~~~ ^~~
psutil/_psutil_osx.c:246:31: warning: implicit conversion loses integer precision: 'long' to 'pid_t' (aka 'int') [-Wshorten-64-to-32]
    if (psutil_get_kinfo_proc(pid, &kp) == -1)
        ~~~~~~~~~~~~~~~~~~~~~ ^~~
psutil/_psutil_osx.c:264:31: warning: implicit conversion loses integer precision: 'long' to 'pid_t' (aka 'int') [-Wshorten-64-to-32]
    if (psutil_get_kinfo_proc(pid, &kp) == -1)
        ~~~~~~~~~~~~~~~~~~~~~ ^~~
psutil/_psutil_osx.c:282:31: warning: implicit conversion loses integer precision: 'long' to 'pid_t' (aka 'int') [-Wshorten-64-to-32]
    if (psutil_get_kinfo_proc(pid, &kp) == -1)
        ~~~~~~~~~~~~~~~~~~~~~ ^~~
psutil/_psutil_osx.c:314:42: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
    err = task_for_pid(mach_task_self(), pid, &task);
          ~~~~~~~~~~~~                   ^~~
psutil/_psutil_osx.c:357:33: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
            proc_regionfilename(pid, address, buf, sizeof(buf));
            ~~~~~~~~~~~~~~~~~~~ ^~~
psutil/_psutil_osx.c:509:31: warning: implicit conversion loses integer precision: 'long' to 'pid_t' (aka 'int') [-Wshorten-64-to-32]
    if (psutil_get_kinfo_proc(pid, &kp) == -1)
        ~~~~~~~~~~~~~~~~~~~~~ ^~~
psutil/_psutil_osx.c:596:42: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
    err = task_for_pid(mach_task_self(), pid, &task);
          ~~~~~~~~~~~~                   ^~~
psutil/_psutil_osx.c:925:25: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
    num = getfsstat(fs, len, MNT_NOWAIT);
          ~~~~~~~~~     ^~~
psutil/_psutil_osx.c:1021:31: warning: implicit conversion loses integer precision: 'long' to 'pid_t' (aka 'int') [-Wshorten-64-to-32]
    if (psutil_get_kinfo_proc(pid, &kp) == -1)
        ~~~~~~~~~~~~~~~~~~~~~ ^~~
psutil/_psutil_osx.c:1054:42: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
    err = task_for_pid(mach_task_self(), pid, &task);
          ~~~~~~~~~~~~                   ^~~
psutil/_psutil_osx.c:1184:33: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
            nb = proc_pidfdinfo(pid,
                 ~~~~~~~~~~~~~~ ^~~
psutil/_psutil_osx.c:1304:33: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
            nb = proc_pidfdinfo(pid, fdp_pointer->proc_fd,
                 ~~~~~~~~~~~~~~ ^~~
psutil/_psutil_osx.c:1448:35: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
    pidinfo_result = proc_pidinfo(pid, PROC_PIDLISTFDS, 0, NULL, 0);
                     ~~~~~~~~~~~~ ^~~
psutil/_psutil_osx.c:1455:35: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
    pidinfo_result = proc_pidinfo(pid, PROC_PIDLISTFDS, 0, fds_pointer,
                     ~~~~~~~~~~~~ ^~~
17 warnings generated.
cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -arch i386 -pipe -DPSUTIL_POSIX=1 -DPSUTIL_VERSION=440 -DPSUTIL_OSX=1 -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c psutil/_psutil_common.c -o build/temp.macosx-10.10-intel-2.7/psutil/_psutil_common.o
psutil/_psutil_common.c:73:16: warning: implicit conversion loses integer precision: 'long' to 'pid_t' (aka 'int') [-Wshorten-64-to-32]
    ret = kill(pid , 0);
          ~~~~ ^~~
1 warning generated.
cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -arch i386 -pipe -DPSUTIL_POSIX=1 -DPSUTIL_VERSION=440 -DPSUTIL_OSX=1 -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c psutil/arch/osx/process_info.c -o build/temp.macosx-10.10-intel-2.7/psutil/arch/osx/process_info.o
psutil/arch/osx/process_info.c:143:14: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
    mib[2] = pid;
           ~ ^~~
psutil/arch/osx/process_info.c:160:11: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
    len = strlen(arg_ptr);
        ~ ^~~~~~~~~~~~~~~
psutil/arch/osx/process_info.c:242:14: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
    mib[2] = pid;
           ~ ^~~
3 warnings generated.
cc -bundle -undefined dynamic_lookup -arch x86_64 -arch i386 -Wl,-F. build/temp.macosx-10.10-intel-2.7/psutil/_psutil_osx.o build/temp.macosx-10.10-intel-2.7/psutil/_psutil_common.o build/temp.macosx-10.10-intel-2.7/psutil/arch/osx/process_info.o -o build/lib.macosx-10.10-intel-2.7/psutil/_psutil_osx.so -framework CoreFoundation -framework IOKit
building 'psutil._psutil_posix' extension
cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -arch i386 -pipe -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c psutil/_psutil_posix.c -o build/temp.macosx-10.10-intel-2.7/psutil/_psutil_posix.o
psutil/_psutil_posix.c:51:42: warning: implicit conversion loses integer precision: 'long' to 'id_t' (aka 'unsigned int') [-Wshorten-64-to-32]
    priority = getpriority(PRIO_PROCESS, pid);
               ~~~~~~~~~~~               ^~~
psutil/_psutil_posix.c:69:40: warning: implicit conversion loses integer precision: 'long' to 'id_t' (aka 'unsigned int') [-Wshorten-64-to-32]
    retval = setpriority(PRIO_PROCESS, pid, priority);
             ~~~~~~~~~~~               ^~~
2 warnings generated.
cc -bundle -undefined dynamic_lookup -arch x86_64 -arch i386 -Wl,-F. build/temp.macosx-10.10-intel-2.7/psutil/_psutil_posix.o -o build/lib.macosx-10.10-intel-2.7/psutil/_psutil_posix.so
python setup.py build_ext -i
running build_ext
copying build/lib.macosx-10.10-intel-2.7/psutil/_psutil_osx.so -> psutil
copying build/lib.macosx-10.10-intel-2.7/psutil/_psutil_posix.so -> psutil
rm -rf tmp

giampaolo added a commit that referenced this issue Oct 12, 2016

@giampaolo giampaolo closed this Oct 18, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment