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

Replace std::unary_function<> with std::function<> #2097

Merged
merged 3 commits into from
Aug 28, 2023

Conversation

ClausKlein
Copy link
Contributor

(deprecated in C++11) and removed in C++17

ACE/ace/Auto_Ptr.h Outdated Show resolved Hide resolved
ACE/ace/Auto_Ptr.h Outdated Show resolved Hide resolved
@ClausKlein
Copy link
Contributor Author

Only in this sources auto_ptr is still used:

bash-3.2$ grep -rw --color auto_ptr */examples
ACE/examples/Smart_Pointers/Widget_Impl.h:  /// - We cannot use auto_ptr to manage the objects, since auto_ptr does not
ACE/examples/Web_Crawler/URL_Visitor.h: * This class is similar to an auto_ptr<> and should be used to
ACE/examples/Reactor/WFMO_Reactor/Window_Messages.cpp:  auto_ptr<ACE_Reactor> reactor (new ACE_Reactor (impl, 1));
ACE/examples/Reactor/WFMO_Reactor/Handle_Close.cpp:  auto_ptr<ACE_Reactor> reactor (create_reactor ());
ACE/examples/Reactor/TP_Reactor/client.cpp:    // put someData in a kind of auto_ptr so it gets deleted automatically
TAO/examples/Load_Balancing/Load_Balancer_i.cpp:      // Temporarily put the servant into the auto_ptr.
TAO/examples/Borland/ChatClientWnd.h:  auto_ptr<TORBThread> orb_thread_;
TAO/examples/Borland/ChatClientWnd.cpp:  auto_ptr<TStringList> ior (new TStringList);
bash-3.2$ 

ACE/ace/Auto_Ptr.h Outdated Show resolved Hide resolved
(deprecated in C++11) and removed in C++17

Add missing #include <memory>

Make the hack clear:
    respect review comment
    ace/Auto_Ptr.h must still include <memory>
@ClausKlein ClausKlein force-pushed the feature/replace-unary_function branch from 70b7a3e to b192a37 Compare August 22, 2023 16:13
@jwillemsen jwillemsen removed their request for review August 23, 2023 06:49
@ClausKlein
Copy link
Contributor Author

On my iMAC with current OSX and clang++16:

clang++ -Wnon-virtual-dtor -std=c++20 -std=c++20 -g -m64 -Wall -Wextra -Wpointer-arith -DACE_HAS_CUSTOM_EXPORT_MACROS=0   -I/Users/clausklein/Workspace/cpp/ACE_TAO/ACE -D__ACE_INLINE__ -I.. -DACE_HAS_IPV6 -DACE_HAS_VERSIONED_NAMESPACE=1 -DACE_BUILD_DLL  -c  -o .shobj/Argv_Type_Converter.o /Users/clausklein/Workspace/cpp/ACE_TAO/ACE/ace/Argv_Type_Converter.cpp
In file included from /Users/clausklein/Workspace/cpp/ACE_TAO/ACE/ace/ACE.cpp:5:
/Users/clausklein/Workspace/cpp/ACE_TAO/ACE/ace/Auto_Ptr.h:73:12: error: no member named 'auto_ptr' in namespace 'std'
using std::auto_ptr; // FIXME(CK): This does NOT compile with c++17 or newer!!!
      ~~~~~^
In file included from /Users/clausklein/Workspace/cpp/ACE_TAO/ACE/ace/Argv_Type_Converter.cpp:1:
In file included from /Users/clausklein/Workspace/cpp/ACE_TAO/ACE/ace/Argv_Type_Converter.h:17:
In file included from /Users/clausklein/Workspace/cpp/ACE_TAO/ACE/ace/OS_Memory.h:152:
In file included from /Users/clausklein/Workspace/cpp/ACE_TAO/ACE/ace/OS_NS_stdlib.h:452:
/Users/clausklein/Workspace/cpp/ACE_TAO/ACE/ace/OS_NS_stdlib.inl:265:12: warning: 'mktemp' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of mktemp(3), it is highly recommended that you use mkstemp(3) instead. [-Wdeprecated-declarations]
  return ::mktemp (s);
           ^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/usr/include/stdlib.h:210:1: note: 'mktemp' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of mktemp(3), it is highly recommended that you use mkstemp(3) instead.")
^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg'
        #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                      ^
In file included from /Users/clausklein/Workspace/cpp/ACE_TAO/ACE/ace/Argv_Type_Converter.cpp:1:
In file included from /Users/clausklein/Workspace/cpp/ACE_TAO/ACE/ace/Argv_Type_Converter.h:17:
In file included from /Users/clausklein/Workspace/cpp/ACE_TAO/ACE/ace/OS_Memory.h:152:
In file included from /Users/clausklein/Workspace/cpp/ACE_TAO/ACE/ace/OS_NS_stdlib.h:452:
/Users/clausklein/Workspace/cpp/ACE_TAO/ACE/ace/OS_NS_stdlib.inl:280:9: warning: 'mktemp' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of mktemp(3), it is highly recommended that you use mkstemp(3) instead. [-Wdeprecated-declarations]
  if (::mktemp (narrow_s.char_rep ()) == 0)
        ^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/usr/include/stdlib.h:210:1: note: 'mktemp' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of mktemp(3), it is highly recommended that you use mkstemp(3) instead.")
^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg'
        #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                      ^
3 warnings and 1 error generated.
make[1]: *** [.shobj/ACE.o] Error 1
make[1]: *** Waiting for unfinished jobs....
2 warnings generated.
3 warnings generated.
3 warnings generated.
3 warnings generated.
3 warnings generated.
make: *** [ACE] Error 2
bash-3.2$ 

@jwillemsen jwillemsen removed their request for review August 24, 2023 07:13
@jwillemsen jwillemsen merged commit ae54a2f into DOCGroup:master Aug 28, 2023
41 checks passed
@jwillemsen
Copy link
Member

See #2109

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

Successfully merging this pull request may close these issues.

2 participants