Issue 8695 - _sleep is deprecated
Summary: _sleep is deprecated
Status: VERIFIED FIXED
Alias: None
Product: OpenLDAP
Classification: Unclassified
Component: slapd (show other issues)
Version: 2.4.45
Hardware: All All
: --- normal
Target Milestone: 2.6.0
Assignee: Quanah Gibson-Mount
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-07-20 01:07 UTC by Quanah Gibson-Mount
Modified: 2021-10-25 22:09 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Quanah Gibson-Mount 2017-07-20 01:07:53 UTC
Full_Name: Quanah Gibson-Mount
Version: 2.4.45
OS: Windows 10 64-bit
URL: ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (47.208.148.239)


When building OpenLDAP, we find:

C:/msys64/home/build/sold-master/openldap/tests/progs/slapd-read.c: In function
'do_read':
C:/msys64/home/build/sold-master/openldap/tests/progs/slapd-read.c:384:11:
warning: '_sleep' is deprecated [-Wdeprecated-declarations]
           sleep( delay );
           ^~~~~
In file included from
C:/msys64/home/build/sold-master/openldap/include/ac/stdlib.h:26:0,
                 from
C:/msys64/home/build/sold-master/openldap/tests/progs/slapd-read.c:24:
C:/msys64/mingw64/x86_64-w64-mingw32/include/stdlib.h:613:24: note: declared
here
   _CRTIMP void __cdecl _sleep(unsigned long _Duration)
__MINGW_ATTRIB_DEPRECATED;
                        ^~~~~~

This comes from:

include/ac/unistd.h

The correct function call is Sleep

#ifdef _WIN32
#define sleep Sleep
#endif

should resolve it.
Comment 1 Howard Chu 2019-06-17 12:11:21 UTC
quanah@openldap.org wrote:
> Full_Name: Quanah Gibson-Mount
> Version: 2.4.45
> OS: Windows 10 64-bit
> URL: ftp://ftp.openldap.org/incoming/
> Submission from: (NULL) (47.208.148.239)
> 
> 
> When building OpenLDAP, we find:
> 
> C:/msys64/home/build/sold-master/openldap/tests/progs/slapd-read.c: In function
> 'do_read':
> C:/msys64/home/build/sold-master/openldap/tests/progs/slapd-read.c:384:11:
> warning: '_sleep' is deprecated [-Wdeprecated-declarations]
>            sleep( delay );
>            ^~~~~
> In file included from
> C:/msys64/home/build/sold-master/openldap/include/ac/stdlib.h:26:0,
>                  from
> C:/msys64/home/build/sold-master/openldap/tests/progs/slapd-read.c:24:
> C:/msys64/mingw64/x86_64-w64-mingw32/include/stdlib.h:613:24: note: declared
> here
>    _CRTIMP void __cdecl _sleep(unsigned long _Duration)
> __MINGW_ATTRIB_DEPRECATED;
>                         ^~~~~~
> 
> This comes from:
> 
> include/ac/unistd.h
> 
> The correct function call is Sleep
> 
> #ifdef _WIN32
> #define sleep Sleep
> #endif
> 
> should resolve it.
> 
> 
Need to be careful here. M$ says the function is supported as of Windows XP
https://docs.microsoft.com/en-us/windows/desktop/api/synchapi/nf-synchapi-sleep

but is not defined in any header files until Windows Vista. Any "fix" should only
use Sleep if the current M$ SDK is new enough; the rest of the code still builds
on Windows XP.

-- 
  -- Howard Chu
  CTO, Symas Corp.           http://www.symas.com
  Director, Highland Sun     http://highlandsun.com/hyc/
  Chief Architect, OpenLDAP  http://www.openldap.org/project/

Comment 3 Quanah Gibson-Mount 2021-07-06 15:42:52 UTC
Commits: 
  • 44e1c653 
by Quanah Gibson-Mount at 2021-06-27T19:03:30+00:00 
ITS#8695 - Update Windows to use Sleep instead of deprecated _sleep