This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Got warning when compiling _scproxy.c on Mac
Type: compile error Stage: resolved
Components: macOS Versions: Python 3.6, Python 3.5
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: ned.deily, ronaldoussoren, vajrasky
Priority: normal Keywords: patch

Created on 2015-06-04 14:20 by vajrasky, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
fix_scproxy_compile_warning.patch vajrasky, 2015-06-04 14:20 review
Messages (3)
msg244824 - (view) Author: Vajrasky Kok (vajrasky) * Date: 2015-06-04 14:20
Got this warning when compiling Python on Mac:

building '_scproxy' extension
gcc -Wno-unused-result -Wsign-compare -g -O0 -Wall -Wstrict-prototypes -Werror=declaration-after-statement -I./Include -I. -IInclude -I/usr/local/include -I/Users/sky/Code/python/cpython/Include -I/Users/sky/Code/python/cpython -c /Users/sky/Code/python/cpython/Modules/_scproxy.c -o build/temp.macosx-10.9-x86_64-3.6-pydebug/Users/sky/Code/python/cpython/Modules/_scproxy.o
/Users/sky/Code/python/cpython/Modules/_scproxy.c:74:10: warning: comparison of address of 'kSCPropNetProxiesExcludeSimpleHostnames' not equal to a null pointer is
      always true [-Wtautological-pointer-compare]
    if (&kSCPropNetProxiesExcludeSimpleHostnames != NULL) {
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~    ~~~~
/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCSchemaDefinitions.h:3812:17: note: expanded from macro 'kSCPropNetProxiesExcludeSimpleHostnames'
          SC_SCHEMA_KV(kSCPropNetProxiesExcludeSimpleHostnames          \
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCSchemaDefinitions.h:469:31: note: expanded from macro 'SC_SCHEMA_KV'
  #define SC_SCHEMA_KV(k,v,t)   k
                                ^
1 warning generated.
gcc -bundle -undefined dynamic_lookup build/temp.macosx-10.9-x86_64-3.6-pydebug/Users/sky/Code/python/cpython/Modules/_scproxy.o -L/usr/local/lib -o build/lib.macosx-10.9-x86_64-3.6-pydebug/_scproxy.cpython-36dm-darwin.so -framework SystemConfiguration -framework CoreFoundation

I am not sure though whether the patch is correct solution. But anyway....
msg245439 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2015-06-17 15:10
The patch is not correct. 

You're probably building with a new enough version of OSX as the deployment target. _scproxy.c should recognise this and should only perform the != NULL test when the variable address might be NULL.

#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_4
   if (if (&kSCPropNetProxiesExcludeSimpleHostnames != NULL) {
#end
      ....

#if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4
   } else {
       ...
   }
#endif

And as the variable is available on OSX 10.4 we could just drop the test and assume it is available.
msg380122 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2020-11-01 09:16
I'm closing this as out of date because the code the compiler warns about is no longer present in the master branch.
History
Date User Action Args
2022-04-11 14:58:17adminsetgithub: 68568
2020-11-01 09:16:38ronaldoussorensetstatus: open -> closed
type: compile error
messages: + msg380122

resolution: out of date
stage: resolved
2015-06-17 15:10:47ronaldoussorensetmessages: + msg245439
2015-06-04 14:20:59vajraskycreate