webrtc_m130/rtc_base/constructor_magic.h

35 lines
1.4 KiB
C
Raw Normal View History

/*
* Copyright 2004 The WebRTC Project Authors. All rights reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef RTC_BASE_CONSTRUCTOR_MAGIC_H_
#define RTC_BASE_CONSTRUCTOR_MAGIC_H_
// Put this in the declarations for a class to be unassignable.
#define RTC_DISALLOW_ASSIGN(TypeName) \
TypeName& operator=(const TypeName&) = delete
// A macro to disallow the copy constructor and operator= functions. This should
// be used in the declarations for a class.
#define RTC_DISALLOW_COPY_AND_ASSIGN(TypeName) \
TypeName(const TypeName&) = delete; \
RTC_DISALLOW_ASSIGN(TypeName)
// A macro to disallow all the implicit constructors, namely the default
// constructor, copy constructor and operator= functions.
//
// This should be used in the declarations for a class that wants to prevent
// anyone from instantiating it. This is especially useful for classes
// containing only static methods.
#define RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(TypeName) \
TypeName() = delete; \
RTC_DISALLOW_COPY_AND_ASSIGN(TypeName)
Revert of Consolidate constructormagic macros with Chromium version and remove Chromium override. (patchset #4 id:60001 of https://codereview.webrtc.org/1316363005/ ) Reason for revert: Had to revert since FYI bots stopped compiling. Example failure: [94/9470] CXX obj\third_party\webrtc\modules\video_processing\main\source\video_processing_sse2.content_analysis_sse2.obj FAILED: ninja -t msvc -e environment.x86 -- E:\b\build\goma/gomacc "E:\b\depot_tools\win_toolchain\vs2013_files\VC\bin\amd64_x86\cl.exe" /nologo /showIncludes /FC @obj\third_party\webrtc\modules\video_coding\codecs\h264\webrtc_h264.h264.obj.rsp /c ..\..\third_party\webrtc\modules\video_coding\codecs\h264\h264.cc /Foobj\third_party\webrtc\modules\video_coding\codecs\h264\webrtc_h264.h264.obj /Fdobj\third_party\webrtc\modules\webrtc_h264.cc.pdb e:\b\build\slave\win\build\src\base\macros.h(28) : error C2220: warning treated as error - no 'object' file generated e:\b\build\slave\win\build\src\base\macros.h(28) : warning C4005: 'DISALLOW_COPY_AND_ASSIGN' : macro redefinition e:\b\build\slave\win\build\src\third_party\webrtc\base\constructormagic.h(27) : see previous definition of 'DISALLOW_COPY_AND_ASSIGN' FAILED: ninja -t msvc -e environment.x86 -- E:\b\build\goma/gomacc "E:\b\depot_tools\win_toolchain\vs2013_files\VC\bin\amd64_x86\cl.exe" /nologo /showIncludes /FC @obj\third_party\webrtc\base\rtc_base_approved.bitbuffer.obj.rsp /c ..\..\third_party\webrtc\base\bitbuffer.cc /Foobj\third_party\webrtc\base\rtc_base_approved.bitbuffer.obj /Fdobj\third_party\webrtc\base\rtc_base_approved.cc.pdb e:\b\build\slave\win\build\src\base\macros.h(28) : error C2220: warning treated as error - no 'object' file generated e:\b\build\slave\win\build\src\base\macros.h(28) : warning C4005: 'DISALLOW_COPY_AND_ASSIGN' : macro redefinition e:\b\build\slave\win\build\src\third_party\webrtc\base\constructormagic.h(27) : see previous definition of 'DISALLOW_COPY_AND_ASSIGN' FAILED: ninja -t msvc -e environment.x86 -- E:\b\build\goma/gomacc "E:\b\depot_tools\win_toolchain\vs2013_files\VC\bin\amd64_x86\cl.exe" /nologo /showIncludes /FC @obj\third_party\webrtc\modules\audio_processing\logging\audio_processing.aec_logging_file_handling.obj.rsp /c ..\..\third_party\webrtc\modules\audio_processing\logging\aec_logging_file_handling.cc /Foobj\third_party\webrtc\modules\audio_processing\logging\audio_processing.aec_logging_file_handling.obj /Fdobj\third_party\webrtc\modules\audio_processing.cc.pdb e:\b\build\slave\win\build\src\base\macros.h(28) : error C2220: warning treated as error - no 'object' file generated e:\b\build\slave\win\build\src\base\macros.h(28) : warning C4005: 'DISALLOW_COPY_AND_ASSIGN' : macro redefinition e:\b\build\slave\win\build\src\third_party\webrtc\base\constructormagic.h(27) : see previous definition of 'DISALLOW_COPY_AND_ASSIGN' FAILED: ninja -t msvc -e environment.x86 -- E:\b\build\goma/gomacc "E:\b\depot_tools\win_toolchain\vs2013_files\VC\bin\amd64_x86\cl.exe" /nologo /showIncludes /FC @obj\third_party\webrtc\modules\audio_processing\beamformer\audio_processing.nonlinear_beamformer.obj.rsp /c ..\..\third_party\webrtc\modules\audio_processing\beamformer\nonlinear_beamformer.cc /Foobj\third_party\webrtc\modules\audio_processing\beamformer\audio_processing.nonlinear_beamformer.obj /Fdobj\third_party\webrtc\modules\audio_processing.cc.pdb e:\b\build\slave\win\build\src\base\macros.h(28) : error C2220: warning treated as error - no 'object' file generated e:\b\build\slave\win\build\src\base\macros.h(28) : warning C4005: 'DISALLOW_COPY_AND_ASSIGN' : macro redefinition e:\b\build\slave\win\build\src\third_party\webrtc\base\constructormagic.h(27) : see previous definition of 'DISALLOW_COPY_AND_ASSIGN' Original issue's description: > Consolidate constructormagic macros with Chromium version and remove Chromium override. > > Part of work removing dependency on Chromium's base. > > Only adds "= delete". From https://codereview.chromium.org/1151443003 : > "This will guarantee the error to be at compile time, and not rely on the call visibility (private)." > > In consequence of that change, fixed an illegal copy and removed a bunch of unused variables. > > BUG=chromium:468375 (in particular comment #37) > NOTRY=true > > Committed: https://crrev.com/0de8ff488d92e0bc6b7b65662898ff5e955cda93 > Cr-Commit-Position: refs/heads/master@{#9913} TBR=andrew@webrtc.org,henrikg@webrtc.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=chromium:468375 (in particular comment #37) Review URL: https://codereview.webrtc.org/1330283002 Cr-Commit-Position: refs/heads/master@{#9914}
2015-09-10 01:41:55 -07:00
#endif // RTC_BASE_CONSTRUCTOR_MAGIC_H_