You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by "yiguolei (via GitHub)" <gi...@apache.org> on 2023/04/19 13:16:01 UTC

[GitHub] [doris] yiguolei opened a new pull request, #18830: [refactor](exceptionsafe) disallow call new method explicitly

yiguolei opened a new pull request, #18830:
URL: https://github.com/apache/doris/pull/18830

   # Proposed changes
   
   1. disallow call new method explicitly
   2. force to use create_shared or create_unique to use shared ptr
   3. placement new is allowed
   
   ## Problem summary
   
   Describe your changes.
   
   ## Checklist(Required)
   
   * [ ] Does it affect the original behavior
   * [ ] Has unit tests been added
   * [ ] Has document been added or modified
   * [ ] Does it need to update dependencies
   * [ ] Is this PR support rollback (If NO, please explain WHY)
   
   ## Further comments
   
   If this is a relatively large or complex change, kick off the discussion at [dev@doris.apache.org](mailto:dev@doris.apache.org) by explaining why you chose the solution you did and what alternatives you considered, etc...
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] yiguolei merged pull request #18830: [refactor](exceptionsafe) disallow call new method explicitly

Posted by "yiguolei (via GitHub)" <gi...@apache.org>.
yiguolei merged PR #18830:
URL: https://github.com/apache/doris/pull/18830


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] github-actions[bot] commented on a diff in pull request #18830: [refactor](exceptionsafe) disallow call new method explicitly

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on code in PR #18830:
URL: https://github.com/apache/doris/pull/18830#discussion_r1171991488


##########
be/src/common/factory_creator.h:
##########
@@ -0,0 +1,51 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#pragma once
+#include <memory>
+
+// All object should inherit from this class, like
+// class A  {
+// DISALLOW_EXPILICT_NEW(A);
+// };
+//
+// Then the caller could not call new A() any more, has to call A::create_shared(...)
+// or A::create_unique(...), then we could make sure all object in our project is shared
+// pointer.
+// But could call A a(...);
+
+// A macro to disallow the copy constructor and operator= functions
+// This should be used in the private: declarations for a class
+//
+// Not use template like cowhelper to implements this feature because it has problem
+// during inherits
+// TODO try to allow make_unique
+#define ENABLE_FACTORY_CREATOR(TypeName)                                                    \

Review Comment:
   warning: macro is not used [clang-diagnostic-unused-macros]
   ```cpp
   #define ENABLE_FACTORY_CREATOR(TypeName)                                                    \
           ^
   ```
   



##########
be/src/vec/core/block.h:
##########
@@ -383,6 +385,8 @@ using BlocksPtr = std::shared_ptr<Blocks>;
 using BlocksPtrs = std::shared_ptr<std::vector<BlocksPtr>>;
 
 class MutableBlock {
+    ENABLE_FACTORY_CREATOR(MutableBlock)

Review Comment:
   warning: extra ';' inside a class [clang-diagnostic-extra-semi]
   
   ```suggestion
       ENABLE_FACTORY_CREATOR(MutableBlock)
   ```
   



##########
be/src/vec/core/block.h:
##########
@@ -53,10 +54,11 @@ namespace vectorized {
   */
 class MutableBlock;
 class Block {
+    ENABLE_FACTORY_CREATOR(Block)

Review Comment:
   warning: extra ';' inside a class [clang-diagnostic-extra-semi]
   
   ```suggestion
       ENABLE_FACTORY_CREATOR(Block)
   ```
   



##########
be/src/vec/core/block.h:
##########
@@ -383,6 +385,8 @@ using BlocksPtr = std::shared_ptr<Blocks>;
 using BlocksPtrs = std::shared_ptr<std::vector<BlocksPtr>>;
 
 class MutableBlock {
+    ENABLE_FACTORY_CREATOR(MutableBlock)

Review Comment:
   warning: friend declaration of 'make_unique' does not match any declaration in namespace 'std' [clang-diagnostic-error]
   ```cpp
       ENABLE_FACTORY_CREATOR(MutableBlock);
       ^
   ```
   **be/src/common/factory_creator.h:52:** expanded from macro 'ENABLE_FACTORY_CREATOR'
   ```cpp
       friend std::unique_ptr<T> std::make_unique(Args&&... args);\
                                      ^
   ```
   



##########
be/src/vec/core/block.h:
##########
@@ -53,10 +54,11 @@ namespace vectorized {
   */
 class MutableBlock;
 class Block {
+    ENABLE_FACTORY_CREATOR(Block)

Review Comment:
   warning: friend declaration of 'make_unique' does not match any declaration in namespace 'std' [clang-diagnostic-error]
   ```cpp
       ENABLE_FACTORY_CREATOR(Block);
       ^
   ```
   **be/src/common/factory_creator.h:52:** expanded from macro 'ENABLE_FACTORY_CREATOR'
   ```cpp
       friend std::unique_ptr<T> std::make_unique(Args&&... args);\
                                      ^
   ```
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] github-actions[bot] commented on a diff in pull request #18830: [refactor](exceptionsafe) disallow call new method explicitly

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on code in PR #18830:
URL: https://github.com/apache/doris/pull/18830#discussion_r1172000492


##########
be/src/vec/exec/scan/pip_scanner_context.h:
##########
@@ -137,11 +137,12 @@ class PipScannerContext : public vectorized::ScannerContext {
                     limit == -1 ? _batch_size : std::min(static_cast<int64_t>(_batch_size), limit);
             int64_t free_blocks_memory_usage = 0;
             for (int i = 0; i < _max_queue_size; ++i) {
-                auto block = std::make_unique<vectorized::Block>(_output_tuple_desc->slots(),
-                                                                 real_block_size,
-                                                                 true /*ignore invalid slots*/);
+                auto block = vectorized::Block::create_unique(_output_tuple_desc->slots(),

Review Comment:
   warning: member access into incomplete type 'const doris::TupleDescriptor' [clang-diagnostic-error]
   ```cpp
                   auto block = vectorized::Block::create_unique(_output_tuple_desc->slots(),
                                                                                   ^
   ```
   **be/src/vec/core/block.h:51:** forward declaration of 'doris::TupleDescriptor'
   ```cpp
   class TupleDescriptor;
         ^
   ```
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] yiguolei commented on pull request #18830: [refactor](exceptionsafe) disallow call new method explicitly

Posted by "yiguolei (via GitHub)" <gi...@apache.org>.
yiguolei commented on PR #18830:
URL: https://github.com/apache/doris/pull/18830#issuecomment-1514734162

   run buildall


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] yiguolei commented on pull request #18830: [refactor](exceptionsafe) disallow call new method explicitly

Posted by "yiguolei (via GitHub)" <gi...@apache.org>.
yiguolei commented on PR #18830:
URL: https://github.com/apache/doris/pull/18830#issuecomment-1515708539

   run buildall


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] yiguolei commented on pull request #18830: [refactor](exceptionsafe) disallow call new method explicitly

Posted by "yiguolei (via GitHub)" <gi...@apache.org>.
yiguolei commented on PR #18830:
URL: https://github.com/apache/doris/pull/18830#issuecomment-1515593017

   run buildall


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] github-actions[bot] commented on a diff in pull request #18830: [refactor](exceptionsafe) disallow call new method explicitly

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on code in PR #18830:
URL: https://github.com/apache/doris/pull/18830#discussion_r1171993802


##########
be/src/vec/core/block.h:
##########
@@ -53,10 +54,11 @@ namespace vectorized {
   */
 class MutableBlock;
 class Block {
+    ENABLE_FACTORY_CREATOR(Block)

Review Comment:
   warning: friend declaration of 'make_unique' does not match any declaration in namespace 'std' [clang-diagnostic-error]
   ```cpp
       ENABLE_FACTORY_CREATOR(Block)
       ^
   ```
   **be/src/common/factory_creator.h:52:** expanded from macro 'ENABLE_FACTORY_CREATOR'
   ```cpp
       friend std::unique_ptr<T> std::make_unique(Args&&... args);\
                                      ^
   ```
   



##########
be/src/vec/core/block.h:
##########
@@ -383,6 +385,8 @@
 using BlocksPtrs = std::shared_ptr<std::vector<BlocksPtr>>;
 
 class MutableBlock {
+    ENABLE_FACTORY_CREATOR(MutableBlock)

Review Comment:
   warning: friend declaration of 'make_unique' does not match any declaration in namespace 'std' [clang-diagnostic-error]
   ```cpp
       ENABLE_FACTORY_CREATOR(MutableBlock)
       ^
   ```
   **be/src/common/factory_creator.h:52:** expanded from macro 'ENABLE_FACTORY_CREATOR'
   ```cpp
       friend std::unique_ptr<T> std::make_unique(Args&&... args);\
                                      ^
   ```
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] github-actions[bot] commented on a diff in pull request #18830: [refactor](exceptionsafe) disallow call new method explicitly

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on code in PR #18830:
URL: https://github.com/apache/doris/pull/18830#discussion_r1172023835


##########
be/src/common/factory_creator.h:
##########
@@ -0,0 +1,55 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#pragma once
+#include <memory>
+
+// All object should inherit from this class, like
+// class A  {
+// DISALLOW_EXPILICT_NEW(A);
+// };
+//
+// Then the caller could not call new A() any more, has to call A::create_shared(...)
+// or A::create_unique(...), then we could make sure all object in our project is shared
+// pointer.
+// But could call A a(...);
+
+// A macro to disallow the copy constructor and operator= functions
+// This should be used in the private: declarations for a class
+//
+// Not use template like cowhelper to implements this feature because it has problem
+// during inherits
+// TODO try to allow make_unique
+//

Review Comment:
   warning: macro is not used [clang-diagnostic-unused-macros]
   ```cpp
   #define ENABLE_FACTORY_CREATOR(TypeName)                                                    \
           ^
   ```
   



##########
be/src/vec/core/block.h:
##########
@@ -67,10 +68,11 @@
 class MutableBlock;
 
 class Block {
+    ENABLE_FACTORY_CREATOR(Block)

Review Comment:
   warning: no matching function for call to 'operator delete[]' [clang-diagnostic-error]
   ```cpp
       ENABLE_FACTORY_CREATOR(Block)
       ^
   ```
   **be/src/common/factory_creator.h:44:** expanded from macro 'ENABLE_FACTORY_CREATOR'
   ```cpp
       void operator delete[](void* ptr, std::size_t size) { ::operator delete[](ptr, size); } \
                                                             ^
   ```
   **/usr/include/c++/11/new:180:** candidate function not viable: no known conversion from 'std::size_t' (aka 'unsigned long') to 'void *' for 2nd argument; take the address of the argument with &
   ```cpp
   inline void operator delete[](void*, void*) _GLIBCXX_USE_NOEXCEPT { }
               ^
   ```
   **/usr/include/c++/11/new:145:** candidate function not viable: no known conversion from 'std::size_t' (aka 'unsigned long') to 'const std::nothrow_t' for 2nd argument
   ```cpp
   void operator delete[](void*, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
        ^
   ```
   **/usr/include/c++/11/new:160:** candidate function not viable: no known conversion from 'std::size_t' (aka 'unsigned long') to 'std::align_val_t' for 2nd argument
   ```cpp
   void operator delete[](void*, std::align_val_t)
        ^
   ```
   **/usr/include/c++/11/new:131:** candidate function not viable: requires 1 argument, but 2 were provided
   ```cpp
   void operator delete[](void*) _GLIBCXX_USE_NOEXCEPT
        ^
   ```
   **/usr/include/c++/11/new:162:** candidate function not viable: requires 3 arguments, but 2 were provided
   ```cpp
   void operator delete[](void*, std::align_val_t, const std::nothrow_t&)
        ^
   ```
   



##########
be/src/vec/core/block.h:
##########
@@ -67,10 +68,11 @@ namespace vectorized {
 class MutableBlock;
 
 class Block {
+    ENABLE_FACTORY_CREATOR(Block)

Review Comment:
   warning: no matching function for call to 'operator delete' [clang-diagnostic-error]
   ```cpp
       ENABLE_FACTORY_CREATOR(Block)
       ^
   ```
   **be/src/common/factory_creator.h:43:** expanded from macro 'ENABLE_FACTORY_CREATOR'
   ```cpp
       void operator delete(void* ptr, std::size_t size) { ::operator delete(ptr, size); }     \
                                                           ^
   ```
   **/usr/include/c++/11/new:179:** candidate function not viable: no known conversion from 'std::size_t' (aka 'unsigned long') to 'void *' for 2nd argument; take the address of the argument with &
   ```cpp
   inline void operator delete  (void*, void*) _GLIBCXX_USE_NOEXCEPT { }
               ^
   ```
   **/usr/include/c++/11/new:143:** candidate function not viable: no known conversion from 'std::size_t' (aka 'unsigned long') to 'const std::nothrow_t' for 2nd argument
   ```cpp
   void operator delete(void*, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
        ^
   ```
   **/usr/include/c++/11/new:152:** candidate function not viable: no known conversion from 'std::size_t' (aka 'unsigned long') to 'std::align_val_t' for 2nd argument
   ```cpp
   void operator delete(void*, std::align_val_t)
        ^
   ```
   **/usr/include/c++/11/new:129:** candidate function not viable: requires 1 argument, but 2 were provided
   ```cpp
   void operator delete(void*) _GLIBCXX_USE_NOEXCEPT
        ^
   ```
   **/usr/include/c++/11/new:154:** candidate function not viable: requires 3 arguments, but 2 were provided
   ```cpp
   void operator delete(void*, std::align_val_t, const std::nothrow_t&)
        ^
   ```
   



##########
be/src/vec/core/block.h:
##########
@@ -397,6 +399,8 @@
 using BlocksPtrs = std::shared_ptr<std::vector<BlocksPtr>>;
 
 class MutableBlock {
+    ENABLE_FACTORY_CREATOR(MutableBlock)

Review Comment:
   warning: no matching function for call to 'operator delete[]' [clang-diagnostic-error]
   ```cpp
       ENABLE_FACTORY_CREATOR(MutableBlock)
       ^
   ```
   **be/src/common/factory_creator.h:44:** expanded from macro 'ENABLE_FACTORY_CREATOR'
   ```cpp
       void operator delete[](void* ptr, std::size_t size) { ::operator delete[](ptr, size); } \
                                                             ^
   ```
   **/usr/include/c++/11/new:180:** candidate function not viable: no known conversion from 'std::size_t' (aka 'unsigned long') to 'void *' for 2nd argument; take the address of the argument with &
   ```cpp
   inline void operator delete[](void*, void*) _GLIBCXX_USE_NOEXCEPT { }
               ^
   ```
   **/usr/include/c++/11/new:145:** candidate function not viable: no known conversion from 'std::size_t' (aka 'unsigned long') to 'const std::nothrow_t' for 2nd argument
   ```cpp
   void operator delete[](void*, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
        ^
   ```
   **/usr/include/c++/11/new:160:** candidate function not viable: no known conversion from 'std::size_t' (aka 'unsigned long') to 'std::align_val_t' for 2nd argument
   ```cpp
   void operator delete[](void*, std::align_val_t)
        ^
   ```
   **/usr/include/c++/11/new:131:** candidate function not viable: requires 1 argument, but 2 were provided
   ```cpp
   void operator delete[](void*) _GLIBCXX_USE_NOEXCEPT
        ^
   ```
   **/usr/include/c++/11/new:162:** candidate function not viable: requires 3 arguments, but 2 were provided
   ```cpp
   void operator delete[](void*, std::align_val_t, const std::nothrow_t&)
        ^
   ```
   



##########
be/src/vec/core/block.h:
##########
@@ -397,6 +399,8 @@
 using BlocksPtrs = std::shared_ptr<std::vector<BlocksPtr>>;
 
 class MutableBlock {
+    ENABLE_FACTORY_CREATOR(MutableBlock)

Review Comment:
   warning: no matching function for call to 'operator delete' [clang-diagnostic-error]
   ```cpp
       ENABLE_FACTORY_CREATOR(MutableBlock)
       ^
   ```
   **be/src/common/factory_creator.h:43:** expanded from macro 'ENABLE_FACTORY_CREATOR'
   ```cpp
       void operator delete(void* ptr, std::size_t size) { ::operator delete(ptr, size); }     \
                                                           ^
   ```
   **/usr/include/c++/11/new:179:** candidate function not viable: no known conversion from 'std::size_t' (aka 'unsigned long') to 'void *' for 2nd argument; take the address of the argument with &
   ```cpp
   inline void operator delete  (void*, void*) _GLIBCXX_USE_NOEXCEPT { }
               ^
   ```
   **/usr/include/c++/11/new:143:** candidate function not viable: no known conversion from 'std::size_t' (aka 'unsigned long') to 'const std::nothrow_t' for 2nd argument
   ```cpp
   void operator delete(void*, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
        ^
   ```
   **/usr/include/c++/11/new:152:** candidate function not viable: no known conversion from 'std::size_t' (aka 'unsigned long') to 'std::align_val_t' for 2nd argument
   ```cpp
   void operator delete(void*, std::align_val_t)
        ^
   ```
   **/usr/include/c++/11/new:129:** candidate function not viable: requires 1 argument, but 2 were provided
   ```cpp
   void operator delete(void*) _GLIBCXX_USE_NOEXCEPT
        ^
   ```
   **/usr/include/c++/11/new:154:** candidate function not viable: requires 3 arguments, but 2 were provided
   ```cpp
   void operator delete(void*, std::align_val_t, const std::nothrow_t&)
        ^
   ```
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] github-actions[bot] commented on a diff in pull request #18830: [refactor](exceptionsafe) disallow call new method explicitly

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on code in PR #18830:
URL: https://github.com/apache/doris/pull/18830#discussion_r1172019481


##########
be/src/vec/core/block.h:
##########
@@ -67,10 +68,11 @@ namespace vectorized {
 class MutableBlock;
 
 class Block {
+    ENABLE_FACTORY_CREATOR(Block)

Review Comment:
   warning: expected ';' after return statement [clang-diagnostic-error]
   ```cpp
       ENABLE_FACTORY_CREATOR(Block)
       ^
   ```
   **be/src/common/factory_creator.h:45:** expanded from macro 'ENABLE_FACTORY_CREATOR'
   ```cpp
       void operator delete(void* ptr, void* place) { return ::operator delete(ptr, place) }      \
                                                                                           ^
   ```
   



##########
be/src/common/factory_creator.h:
##########
@@ -0,0 +1,54 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#pragma once
+#include <memory>
+
+// All object should inherit from this class, like
+// class A  {
+// DISALLOW_EXPILICT_NEW(A);
+// };
+//
+// Then the caller could not call new A() any more, has to call A::create_shared(...)
+// or A::create_unique(...), then we could make sure all object in our project is shared
+// pointer.
+// But could call A a(...);
+
+// A macro to disallow the copy constructor and operator= functions
+// This should be used in the private: declarations for a class
+//
+// Not use template like cowhelper to implements this feature because it has problem
+// during inherits
+// TODO try to allow make_unique
+#define ENABLE_FACTORY_CREATOR(TypeName)                                                           \

Review Comment:
   warning: macro is not used [clang-diagnostic-unused-macros]
   ```cpp
   #define ENABLE_FACTORY_CREATOR(TypeName)                                                       \
           ^
   ```
   



##########
be/src/vec/core/block.h:
##########
@@ -397,6 +399,8 @@
 using BlocksPtrs = std::shared_ptr<std::vector<BlocksPtr>>;
 
 class MutableBlock {
+    ENABLE_FACTORY_CREATOR(MutableBlock)

Review Comment:
   warning: expected ';' after return statement [clang-diagnostic-error]
   ```cpp
       ENABLE_FACTORY_CREATOR(MutableBlock)
       ^
   ```
   **be/src/common/factory_creator.h:45:** expanded from macro 'ENABLE_FACTORY_CREATOR'
   ```cpp
       void operator delete(void* ptr, void* place) { return ::operator delete(ptr, place) }      \
                                                                                           ^
   ```
   



##########
be/src/vec/core/block.h:
##########
@@ -67,10 +68,11 @@
 class MutableBlock;
 
 class Block {
+    ENABLE_FACTORY_CREATOR(Block)

Review Comment:
   warning: use of undeclared identifier 'size' [clang-diagnostic-error]
   ```cpp
       ENABLE_FACTORY_CREATOR(Block)
       ^
   ```
   **be/src/common/factory_creator.h:44:** expanded from macro 'ENABLE_FACTORY_CREATOR'
   ```cpp
       void operator delete[](void* ptr, std::size_t sz) { return ::operator delete(ptr, size); } \
                                                                                         ^
   ```
   



##########
be/src/vec/core/block.h:
##########
@@ -397,6 +399,8 @@
 using BlocksPtrs = std::shared_ptr<std::vector<BlocksPtr>>;
 
 class MutableBlock {
+    ENABLE_FACTORY_CREATOR(MutableBlock)

Review Comment:
   warning: use of undeclared identifier 'size' [clang-diagnostic-error]
   ```cpp
       ENABLE_FACTORY_CREATOR(MutableBlock)
       ^
   ```
   **be/src/common/factory_creator.h:44:** expanded from macro 'ENABLE_FACTORY_CREATOR'
   ```cpp
       void operator delete[](void* ptr, std::size_t sz) { return ::operator delete(ptr, size); } \
                                                                                         ^
   ```
   



##########
be/src/vec/core/block.h:
##########
@@ -67,10 +68,11 @@
 class MutableBlock;
 
 class Block {
+    ENABLE_FACTORY_CREATOR(Block)

Review Comment:
   warning: no matching function for call to 'operator delete' [clang-diagnostic-error]
   ```cpp
       ENABLE_FACTORY_CREATOR(Block)
       ^
   ```
   **be/src/common/factory_creator.h:43:** expanded from macro 'ENABLE_FACTORY_CREATOR'
   ```cpp
       void operator delete(void* ptr, std::size_t size) { return ::operator delete(ptr, size); } \
                                                                  ^
   ```
   **/usr/include/c++/11/new:179:** candidate function not viable: no known conversion from 'std::size_t' (aka 'unsigned long') to 'void *' for 2nd argument; take the address of the argument with &
   ```cpp
   inline void operator delete  (void*, void*) _GLIBCXX_USE_NOEXCEPT { }
               ^
   ```
   **/usr/include/c++/11/new:143:** candidate function not viable: no known conversion from 'std::size_t' (aka 'unsigned long') to 'const std::nothrow_t' for 2nd argument
   ```cpp
   void operator delete(void*, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
        ^
   ```
   **/usr/include/c++/11/new:152:** candidate function not viable: no known conversion from 'std::size_t' (aka 'unsigned long') to 'std::align_val_t' for 2nd argument
   ```cpp
   void operator delete(void*, std::align_val_t)
        ^
   ```
   **/usr/include/c++/11/new:129:** candidate function not viable: requires 1 argument, but 2 were provided
   ```cpp
   void operator delete(void*) _GLIBCXX_USE_NOEXCEPT
        ^
   ```
   **/usr/include/c++/11/new:154:** candidate function not viable: requires 3 arguments, but 2 were provided
   ```cpp
   void operator delete(void*, std::align_val_t, const std::nothrow_t&)
        ^
   ```
   



##########
be/src/vec/core/block.h:
##########
@@ -397,6 +399,8 @@
 using BlocksPtrs = std::shared_ptr<std::vector<BlocksPtr>>;
 
 class MutableBlock {
+    ENABLE_FACTORY_CREATOR(MutableBlock)

Review Comment:
   warning: no matching function for call to 'operator delete' [clang-diagnostic-error]
   ```cpp
       ENABLE_FACTORY_CREATOR(MutableBlock)
       ^
   ```
   **be/src/common/factory_creator.h:43:** expanded from macro 'ENABLE_FACTORY_CREATOR'
   ```cpp
       void operator delete(void* ptr, std::size_t size) { return ::operator delete(ptr, size); } \
                                                                  ^
   ```
   **/usr/include/c++/11/new:179:** candidate function not viable: no known conversion from 'std::size_t' (aka 'unsigned long') to 'void *' for 2nd argument; take the address of the argument with &
   ```cpp
   inline void operator delete  (void*, void*) _GLIBCXX_USE_NOEXCEPT { }
               ^
   ```
   **/usr/include/c++/11/new:143:** candidate function not viable: no known conversion from 'std::size_t' (aka 'unsigned long') to 'const std::nothrow_t' for 2nd argument
   ```cpp
   void operator delete(void*, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
        ^
   ```
   **/usr/include/c++/11/new:152:** candidate function not viable: no known conversion from 'std::size_t' (aka 'unsigned long') to 'std::align_val_t' for 2nd argument
   ```cpp
   void operator delete(void*, std::align_val_t)
        ^
   ```
   **/usr/include/c++/11/new:129:** candidate function not viable: requires 1 argument, but 2 were provided
   ```cpp
   void operator delete(void*) _GLIBCXX_USE_NOEXCEPT
        ^
   ```
   **/usr/include/c++/11/new:154:** candidate function not viable: requires 3 arguments, but 2 were provided
   ```cpp
   void operator delete(void*, std::align_val_t, const std::nothrow_t&)
        ^
   ```
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] yiguolei commented on pull request #18830: [refactor](exceptionsafe) disallow call new method explicitly

Posted by "yiguolei (via GitHub)" <gi...@apache.org>.
yiguolei commented on PR #18830:
URL: https://github.com/apache/doris/pull/18830#issuecomment-1516149593

   run buildall


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] github-actions[bot] commented on a diff in pull request #18830: [refactor](exceptionsafe) disallow call new method explicitly

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on code in PR #18830:
URL: https://github.com/apache/doris/pull/18830#discussion_r1172020221


##########
be/src/vec/core/block.h:
##########
@@ -67,10 +68,11 @@ namespace vectorized {
 class MutableBlock;
 
 class Block {
+    ENABLE_FACTORY_CREATOR(Block)

Review Comment:
   warning: expected ';' after return statement [clang-diagnostic-error]
   ```cpp
       ENABLE_FACTORY_CREATOR(Block)
       ^
   ```
   **be/src/common/factory_creator.h:45:** expanded from macro 'ENABLE_FACTORY_CREATOR'
   ```cpp
       void operator delete(void* ptr, void* place) { return ::operator delete(ptr, place) }        \
                                                                                           ^
   ```
   



##########
be/src/common/factory_creator.h:
##########
@@ -0,0 +1,54 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#pragma once
+#include <memory>
+
+// All object should inherit from this class, like
+// class A  {
+// DISALLOW_EXPILICT_NEW(A);
+// };
+//
+// Then the caller could not call new A() any more, has to call A::create_shared(...)
+// or A::create_unique(...), then we could make sure all object in our project is shared
+// pointer.
+// But could call A a(...);
+
+// A macro to disallow the copy constructor and operator= functions
+// This should be used in the private: declarations for a class
+//
+// Not use template like cowhelper to implements this feature because it has problem
+// during inherits
+// TODO try to allow make_unique
+#define ENABLE_FACTORY_CREATOR(TypeName)                                                           \

Review Comment:
   warning: macro is not used [clang-diagnostic-unused-macros]
   ```cpp
   #define ENABLE_FACTORY_CREATOR(TypeName)                                                         \
           ^
   ```
   



##########
be/src/vec/core/block.h:
##########
@@ -67,10 +68,11 @@
 class MutableBlock;
 
 class Block {
+    ENABLE_FACTORY_CREATOR(Block)

Review Comment:
   warning: no matching function for call to 'operator delete' [clang-diagnostic-error]
   ```cpp
       ENABLE_FACTORY_CREATOR(Block)
       ^
   ```
   **be/src/common/factory_creator.h:43:** expanded from macro 'ENABLE_FACTORY_CREATOR'
   ```cpp
       void operator delete(void* ptr, std::size_t size) { return ::operator delete(ptr, size); }   \
                                                                  ^
   ```
   **/usr/include/c++/11/new:179:** candidate function not viable: no known conversion from 'std::size_t' (aka 'unsigned long') to 'void *' for 2nd argument; take the address of the argument with &
   ```cpp
   inline void operator delete  (void*, void*) _GLIBCXX_USE_NOEXCEPT { }
               ^
   ```
   **/usr/include/c++/11/new:143:** candidate function not viable: no known conversion from 'std::size_t' (aka 'unsigned long') to 'const std::nothrow_t' for 2nd argument
   ```cpp
   void operator delete(void*, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
        ^
   ```
   **/usr/include/c++/11/new:152:** candidate function not viable: no known conversion from 'std::size_t' (aka 'unsigned long') to 'std::align_val_t' for 2nd argument
   ```cpp
   void operator delete(void*, std::align_val_t)
        ^
   ```
   **/usr/include/c++/11/new:129:** candidate function not viable: requires 1 argument, but 2 were provided
   ```cpp
   void operator delete(void*) _GLIBCXX_USE_NOEXCEPT
        ^
   ```
   **/usr/include/c++/11/new:154:** candidate function not viable: requires 3 arguments, but 2 were provided
   ```cpp
   void operator delete(void*, std::align_val_t, const std::nothrow_t&)
        ^
   ```
   



##########
be/src/vec/core/block.h:
##########
@@ -397,6 +399,8 @@
 using BlocksPtrs = std::shared_ptr<std::vector<BlocksPtr>>;
 
 class MutableBlock {
+    ENABLE_FACTORY_CREATOR(MutableBlock)

Review Comment:
   warning: expected ';' after return statement [clang-diagnostic-error]
   ```cpp
       ENABLE_FACTORY_CREATOR(MutableBlock)
       ^
   ```
   **be/src/common/factory_creator.h:45:** expanded from macro 'ENABLE_FACTORY_CREATOR'
   ```cpp
       void operator delete(void* ptr, void* place) { return ::operator delete(ptr, place) }        \
                                                                                           ^
   ```
   



##########
be/src/vec/core/block.h:
##########
@@ -397,6 +399,8 @@
 using BlocksPtrs = std::shared_ptr<std::vector<BlocksPtr>>;
 
 class MutableBlock {
+    ENABLE_FACTORY_CREATOR(MutableBlock)

Review Comment:
   warning: no matching function for call to 'operator delete' [clang-diagnostic-error]
   ```cpp
       ENABLE_FACTORY_CREATOR(MutableBlock)
       ^
   ```
   **be/src/common/factory_creator.h:43:** expanded from macro 'ENABLE_FACTORY_CREATOR'
   ```cpp
       void operator delete(void* ptr, std::size_t size) { return ::operator delete(ptr, size); }   \
                                                                  ^
   ```
   **/usr/include/c++/11/new:179:** candidate function not viable: no known conversion from 'std::size_t' (aka 'unsigned long') to 'void *' for 2nd argument; take the address of the argument with &
   ```cpp
   inline void operator delete  (void*, void*) _GLIBCXX_USE_NOEXCEPT { }
               ^
   ```
   **/usr/include/c++/11/new:143:** candidate function not viable: no known conversion from 'std::size_t' (aka 'unsigned long') to 'const std::nothrow_t' for 2nd argument
   ```cpp
   void operator delete(void*, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
        ^
   ```
   **/usr/include/c++/11/new:152:** candidate function not viable: no known conversion from 'std::size_t' (aka 'unsigned long') to 'std::align_val_t' for 2nd argument
   ```cpp
   void operator delete(void*, std::align_val_t)
        ^
   ```
   **/usr/include/c++/11/new:129:** candidate function not viable: requires 1 argument, but 2 were provided
   ```cpp
   void operator delete(void*) _GLIBCXX_USE_NOEXCEPT
        ^
   ```
   **/usr/include/c++/11/new:154:** candidate function not viable: requires 3 arguments, but 2 were provided
   ```cpp
   void operator delete(void*, std::align_val_t, const std::nothrow_t&)
        ^
   ```
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] github-actions[bot] commented on pull request #18830: [refactor](exceptionsafe) disallow call new method explicitly

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #18830:
URL: https://github.com/apache/doris/pull/18830#issuecomment-1517117778

   PR approved by anyone and no changes requested.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] github-actions[bot] commented on pull request #18830: [refactor](exceptionsafe) disallow call new method explicitly

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #18830:
URL: https://github.com/apache/doris/pull/18830#issuecomment-1517117723

   PR approved by at least one committer and no changes requested.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] github-actions[bot] commented on a diff in pull request #18830: [refactor](exceptionsafe) disallow call new method explicitly

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on code in PR #18830:
URL: https://github.com/apache/doris/pull/18830#discussion_r1172021569


##########
be/src/vec/core/block.h:
##########
@@ -397,6 +399,8 @@
 using BlocksPtrs = std::shared_ptr<std::vector<BlocksPtr>>;
 
 class MutableBlock {
+    ENABLE_FACTORY_CREATOR(MutableBlock)

Review Comment:
   warning: no matching function for call to 'operator delete' [clang-diagnostic-error]
   ```cpp
       ENABLE_FACTORY_CREATOR(MutableBlock)
       ^
   ```
   **be/src/common/factory_creator.h:43:** expanded from macro 'ENABLE_FACTORY_CREATOR'
   ```cpp
       void operator delete(void* ptr, std::size_t size) { return ::operator delete(ptr, size); }     \
                                                                  ^
   ```
   **/usr/include/c++/11/new:179:** candidate function not viable: no known conversion from 'std::size_t' (aka 'unsigned long') to 'void *' for 2nd argument; take the address of the argument with &
   ```cpp
   inline void operator delete  (void*, void*) _GLIBCXX_USE_NOEXCEPT { }
               ^
   ```
   **/usr/include/c++/11/new:143:** candidate function not viable: no known conversion from 'std::size_t' (aka 'unsigned long') to 'const std::nothrow_t' for 2nd argument
   ```cpp
   void operator delete(void*, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
        ^
   ```
   **/usr/include/c++/11/new:152:** candidate function not viable: no known conversion from 'std::size_t' (aka 'unsigned long') to 'std::align_val_t' for 2nd argument
   ```cpp
   void operator delete(void*, std::align_val_t)
        ^
   ```
   **/usr/include/c++/11/new:129:** candidate function not viable: requires 1 argument, but 2 were provided
   ```cpp
   void operator delete(void*) _GLIBCXX_USE_NOEXCEPT
        ^
   ```
   **/usr/include/c++/11/new:154:** candidate function not viable: requires 3 arguments, but 2 were provided
   ```cpp
   void operator delete(void*, std::align_val_t, const std::nothrow_t&)
        ^
   ```
   



##########
be/src/common/factory_creator.h:
##########
@@ -0,0 +1,54 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#pragma once
+#include <memory>
+
+// All object should inherit from this class, like
+// class A  {
+// DISALLOW_EXPILICT_NEW(A);
+// };
+//
+// Then the caller could not call new A() any more, has to call A::create_shared(...)
+// or A::create_unique(...), then we could make sure all object in our project is shared
+// pointer.
+// But could call A a(...);
+
+// A macro to disallow the copy constructor and operator= functions
+// This should be used in the private: declarations for a class
+//
+// Not use template like cowhelper to implements this feature because it has problem
+// during inherits
+// TODO try to allow make_unique
+#define ENABLE_FACTORY_CREATOR(TypeName)                                                    \

Review Comment:
   warning: macro is not used [clang-diagnostic-unused-macros]
   ```cpp
   #define ENABLE_FACTORY_CREATOR(TypeName)                                                           \
           ^
   ```
   



##########
be/src/vec/core/block.h:
##########
@@ -67,10 +68,11 @@
 class MutableBlock;
 
 class Block {
+    ENABLE_FACTORY_CREATOR(Block)

Review Comment:
   warning: no matching function for call to 'operator delete[]' [clang-diagnostic-error]
   ```cpp
       ENABLE_FACTORY_CREATOR(Block)
       ^
   ```
   **be/src/common/factory_creator.h:44:** expanded from macro 'ENABLE_FACTORY_CREATOR'
   ```cpp
       void operator delete[](void* ptr, std::size_t size) { return ::operator delete[](ptr, size); } \
                                                                    ^
   ```
   **/usr/include/c++/11/new:180:** candidate function not viable: no known conversion from 'std::size_t' (aka 'unsigned long') to 'void *' for 2nd argument; take the address of the argument with &
   ```cpp
   inline void operator delete[](void*, void*) _GLIBCXX_USE_NOEXCEPT { }
               ^
   ```
   **/usr/include/c++/11/new:145:** candidate function not viable: no known conversion from 'std::size_t' (aka 'unsigned long') to 'const std::nothrow_t' for 2nd argument
   ```cpp
   void operator delete[](void*, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
        ^
   ```
   **/usr/include/c++/11/new:160:** candidate function not viable: no known conversion from 'std::size_t' (aka 'unsigned long') to 'std::align_val_t' for 2nd argument
   ```cpp
   void operator delete[](void*, std::align_val_t)
        ^
   ```
   **/usr/include/c++/11/new:131:** candidate function not viable: requires 1 argument, but 2 were provided
   ```cpp
   void operator delete[](void*) _GLIBCXX_USE_NOEXCEPT
        ^
   ```
   **/usr/include/c++/11/new:162:** candidate function not viable: requires 3 arguments, but 2 were provided
   ```cpp
   void operator delete[](void*, std::align_val_t, const std::nothrow_t&)
        ^
   ```
   



##########
be/src/vec/core/block.h:
##########
@@ -67,10 +68,11 @@ namespace vectorized {
 class MutableBlock;
 
 class Block {
+    ENABLE_FACTORY_CREATOR(Block)

Review Comment:
   warning: no matching function for call to 'operator delete' [clang-diagnostic-error]
   ```cpp
       ENABLE_FACTORY_CREATOR(Block)
       ^
   ```
   **be/src/common/factory_creator.h:43:** expanded from macro 'ENABLE_FACTORY_CREATOR'
   ```cpp
       void operator delete(void* ptr, std::size_t size) { return ::operator delete(ptr, size); }     \
                                                                  ^
   ```
   **/usr/include/c++/11/new:179:** candidate function not viable: no known conversion from 'std::size_t' (aka 'unsigned long') to 'void *' for 2nd argument; take the address of the argument with &
   ```cpp
   inline void operator delete  (void*, void*) _GLIBCXX_USE_NOEXCEPT { }
               ^
   ```
   **/usr/include/c++/11/new:143:** candidate function not viable: no known conversion from 'std::size_t' (aka 'unsigned long') to 'const std::nothrow_t' for 2nd argument
   ```cpp
   void operator delete(void*, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
        ^
   ```
   **/usr/include/c++/11/new:152:** candidate function not viable: no known conversion from 'std::size_t' (aka 'unsigned long') to 'std::align_val_t' for 2nd argument
   ```cpp
   void operator delete(void*, std::align_val_t)
        ^
   ```
   **/usr/include/c++/11/new:129:** candidate function not viable: requires 1 argument, but 2 were provided
   ```cpp
   void operator delete(void*) _GLIBCXX_USE_NOEXCEPT
        ^
   ```
   **/usr/include/c++/11/new:154:** candidate function not viable: requires 3 arguments, but 2 were provided
   ```cpp
   void operator delete(void*, std::align_val_t, const std::nothrow_t&)
        ^
   ```
   



##########
be/src/vec/core/block.h:
##########
@@ -397,6 +399,8 @@
 using BlocksPtrs = std::shared_ptr<std::vector<BlocksPtr>>;
 
 class MutableBlock {
+    ENABLE_FACTORY_CREATOR(MutableBlock)

Review Comment:
   warning: no matching function for call to 'operator delete[]' [clang-diagnostic-error]
   ```cpp
       ENABLE_FACTORY_CREATOR(MutableBlock)
       ^
   ```
   **be/src/common/factory_creator.h:44:** expanded from macro 'ENABLE_FACTORY_CREATOR'
   ```cpp
       void operator delete[](void* ptr, std::size_t size) { return ::operator delete[](ptr, size); } \
                                                                    ^
   ```
   **/usr/include/c++/11/new:180:** candidate function not viable: no known conversion from 'std::size_t' (aka 'unsigned long') to 'void *' for 2nd argument; take the address of the argument with &
   ```cpp
   inline void operator delete[](void*, void*) _GLIBCXX_USE_NOEXCEPT { }
               ^
   ```
   **/usr/include/c++/11/new:145:** candidate function not viable: no known conversion from 'std::size_t' (aka 'unsigned long') to 'const std::nothrow_t' for 2nd argument
   ```cpp
   void operator delete[](void*, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
        ^
   ```
   **/usr/include/c++/11/new:160:** candidate function not viable: no known conversion from 'std::size_t' (aka 'unsigned long') to 'std::align_val_t' for 2nd argument
   ```cpp
   void operator delete[](void*, std::align_val_t)
        ^
   ```
   **/usr/include/c++/11/new:131:** candidate function not viable: requires 1 argument, but 2 were provided
   ```cpp
   void operator delete[](void*) _GLIBCXX_USE_NOEXCEPT
        ^
   ```
   **/usr/include/c++/11/new:162:** candidate function not viable: requires 3 arguments, but 2 were provided
   ```cpp
   void operator delete[](void*, std::align_val_t, const std::nothrow_t&)
        ^
   ```
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] github-actions[bot] commented on a diff in pull request #18830: [refactor](exceptionsafe) disallow call new method explicitly

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on code in PR #18830:
URL: https://github.com/apache/doris/pull/18830#discussion_r1172031152


##########
be/src/common/factory_creator.h:
##########
@@ -0,0 +1,55 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#pragma once
+#include <memory>
+
+// All object should inherit from this class, like
+// class A  {
+// DISALLOW_EXPILICT_NEW(A);
+// };
+//
+// Then the caller could not call new A() any more, has to call A::create_shared(...)
+// or A::create_unique(...), then we could make sure all object in our project is shared
+// pointer.
+// But could call A a(...);
+
+// A macro to disallow the copy constructor and operator= functions
+// This should be used in the private: declarations for a class
+//
+// Not use template like cowhelper to implements this feature because it has problem
+// during inherits
+// TODO try to allow make_unique
+//
+#define ENABLE_FACTORY_CREATOR(TypeName)                                                     \

Review Comment:
   warning: macro is not used [clang-diagnostic-unused-macros]
   ```cpp
   #define ENABLE_FACTORY_CREATOR(TypeName)                                                     \
           ^
   ```
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] github-actions[bot] commented on a diff in pull request #18830: [refactor](exceptionsafe) disallow call new method explicitly

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on code in PR #18830:
URL: https://github.com/apache/doris/pull/18830#discussion_r1171350657


##########
be/src/common/smart_ptr_helper.h:
##########
@@ -0,0 +1,51 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#pragma once
+#include <memory>
+
+// All object should inherit from this class, like
+// class A  {
+// DISALLOW_EXPILICT_NEW(A);
+// };
+//
+// Then the caller could not call new A() any more, has to call A::create_shared(...)
+// or A::create_unique(...), then we could make sure all object in our project is shared
+// pointer.
+// But could call A a(...);
+
+// A macro to disallow the copy constructor and operator= functions
+// This should be used in the private: declarations for a class
+//
+// Not use template like cowhelper to implements this feature because it has problem
+// during inherits
+// TODO try to allow make_unique
+#define DISALLOW_EXPILICT_NEW(TypeName)                                                     \

Review Comment:
   warning: macro is not used [clang-diagnostic-unused-macros]
   ```cpp
   #define DISALLOW_EXPILICT_NEW(TypeName)                                                     \
           ^
   ```
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] github-actions[bot] commented on a diff in pull request #18830: [refactor](exceptionsafe) disallow call new method explicitly

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on code in PR #18830:
URL: https://github.com/apache/doris/pull/18830#discussion_r1172028234


##########
be/src/common/factory_creator.h:
##########
@@ -0,0 +1,55 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#pragma once
+#include <memory>
+
+// All object should inherit from this class, like
+// class A  {
+// DISALLOW_EXPILICT_NEW(A);
+// };
+//
+// Then the caller could not call new A() any more, has to call A::create_shared(...)
+// or A::create_unique(...), then we could make sure all object in our project is shared
+// pointer.
+// But could call A a(...);
+
+// A macro to disallow the copy constructor and operator= functions
+// This should be used in the private: declarations for a class
+//
+// Not use template like cowhelper to implements this feature because it has problem
+// during inherits
+// TODO try to allow make_unique
+//
+#define ENABLE_FACTORY_CREATOR(TypeName)                                                     \

Review Comment:
   warning: macro is not used [clang-diagnostic-unused-macros]
   ```cpp
   #define ENABLE_FACTORY_CREATOR(TypeName)                                                    \
           ^
   ```
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] yiguolei commented on pull request #18830: [refactor](exceptionsafe) disallow call new method explicitly

Posted by "yiguolei (via GitHub)" <gi...@apache.org>.
yiguolei commented on PR #18830:
URL: https://github.com/apache/doris/pull/18830#issuecomment-1515939303

   run p0


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] yiguolei commented on pull request #18830: [refactor](exceptionsafe) disallow call new method explicitly

Posted by "yiguolei (via GitHub)" <gi...@apache.org>.
yiguolei commented on PR #18830:
URL: https://github.com/apache/doris/pull/18830#issuecomment-1515740077

   run buildall


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org