• Stiopa Koltsov's avatar
    folly/string: better strerror_r detection · fa3eb5b1
    Stiopa Koltsov authored
    Summary:
    There are two variants of `strerror_r` function, one returns
    `int`, and another returns `char*`. Selecting proper version using
    preprocessor macros portably is extremely hard.
    
    For example, on Android function signature depends on `__USE_GNU` and
    `__ANDROID_API__` macros (https://git.io/fjBBE).
    
    So we are using C++ overloading trick: we pass a pointer of
    `strerror_r` to `invoke_strerror_r` function, and C++ compiler
    selects proper function.
    
    Reviewed By: yfeldblum
    
    Differential Revision: D15484722
    
    fbshipit-source-id: fc0bd45fa67dc401631ffc185c9fad231e4a48a0
    fa3eb5b1
FollyConfigChecks.cmake 6.49 KB