Page MenuHomePhabricator

scripted-diff: rename NetPermissionFlags enumerators
ClosedPublic

Authored by PiRK on Mar 14 2023, 10:23.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABCabeea1821e71: scripted-diff: rename NetPermissionFlags enumerators
Summary
-BEGIN VERIFY SCRIPT-
s() { git grep -l "$1" src | xargs sed -i "s/$1/$2/g"; }

s 'PF_NONE'        'None'
s 'PF_BLOOMFILTER' 'BloomFilter'
s 'PF_RELAY'       'Relay'
s 'PF_FORCERELAY'  'ForceRelay'
s 'PF_DOWNLOAD'    'Download'
s 'PF_NOBAN'       'NoBan'
s 'PF_MEMPOOL'     'Mempool'
s 'PF_ADDR'        'Addr'
s 'PF_ISIMPLICIT'  'Implicit'
s 'PF_ALL'         'All'
s 'PF_BYPASS_PROOF_REQUEST_LIMITS' 'BypassProofRequestLimits'

s() { git grep -l "$1" src/net_processing.cpp | xargs sed -i "s/$1/$2/g"; }
s 'the noban permission'      'NetPermissionFlags::NoBan permission'
s 'the NOBAN permission flag' 'NetPermissionFlags::NoBan permission'
s 'noban permission'          'NetPermissionFlags::NoBan permission'

arc lint
-END VERIFY SCRIPT-

This is a partial backport of core#21506
https://github.com/bitcoin/bitcoin/pull/21506/commits/a95540cf435029f06e56749802d71315ca76b0dd
https://github.com/bitcoin/bitcoin/pull/21506/commits/7075f604e8d0b21b2255fa57e20cd365dc10a288

Co-authored-by: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com>

Depends on D13325

Test Plan

ninja all check-all bitcoin-fuzzers

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

PiRK requested review of this revision.Mar 14 2023, 10:23

Tail of the build log:

[504/538] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/peertablemodel.cpp.o
[505/538] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/recentrequeststablemodel.cpp.o
[506/538] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/sendcoinsentry.cpp.o
[507/538] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/bitcoin-qt-base_autogen/mocs_compilation.cpp.o
FAILED: src/qt/CMakeFiles/bitcoin-qt-base.dir/bitcoin-qt-base_autogen/mocs_compilation.cpp.o 
/usr/bin/ccache /usr/bin/clang++ -DBOOST_AC_USE_STD_ATOMIC -DBOOST_ALL_NO_LIB -DBOOST_ATOMIC_DYN_LINK -DBOOST_FILESYSTEM_DYN_LINK -DBOOST_SP_USE_STD_ATOMIC -DBOOST_THREAD_DYN_LINK -DBUILD_BITCOIN_INTERNAL -DENABLE_AVX2 -DENABLE_SHANI -DENABLE_SSE41 -DHAVE_BUILD_INFO -DHAVE_CONFIG_H -DHAVE_CONSENSUS_LIB -DHAVE_DECL_EVP_MD_CTX_NEW=1 -DLEVELDB_ATOMIC_PRESENT -DLEVELDB_PLATFORM_POSIX -DOS_LINUX -DQT_CORE_LIB -DQT_DBUS_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DUSE_PROTOBUF_MESSAGE_BYTESIZELONG -Isrc/qt/bitcoin-qt-base_autogen/include -I../../src/. -Isrc -I../../src/univalue/include -Isrc/crypto/.. -I../../src/secp256k1/include -I../../src/leveldb/include -isystem /usr/include/jemalloc -isystem /usr/include/miniupnpc -isystem /usr/include/x86_64-linux-gnu/qt5 -isystem /usr/include/x86_64-linux-gnu/qt5/QtWidgets -isystem /usr/include/x86_64-linux-gnu/qt5/QtGui -isystem /usr/include/x86_64-linux-gnu/qt5/QtCore -isystem /usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++ -isystem /usr/include/x86_64-linux-gnu/qt5/QtNetwork -isystem /usr/include/x86_64-linux-gnu/qt5/QtDBus -Werror -g -O2 -fPIC -fvisibility=hidden -fstack-protector-all -Wstack-protector -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -Wall -Wextra -Wformat -Wgnu -Wvla -Wcast-align -Wunused-parameter -Wmissing-braces -Wthread-safety -Wrange-loop-analysis -Wredundant-decls -Wunreachable-code-loop-increment -Wsign-compare -Wconditional-uninitialized -Wdocumentation -Wformat-security -Wredundant-move -Woverloaded-virtual -Wshadow -Wshadow-field -Wno-unused-parameter -Wno-implicit-fallthrough -Wno-psabi -pthread -fPIC -std=gnu++17 -MD -MT src/qt/CMakeFiles/bitcoin-qt-base.dir/bitcoin-qt-base_autogen/mocs_compilation.cpp.o -MF src/qt/CMakeFiles/bitcoin-qt-base.dir/bitcoin-qt-base_autogen/mocs_compilation.cpp.o.d -o src/qt/CMakeFiles/bitcoin-qt-base.dir/bitcoin-qt-base_autogen/mocs_compilation.cpp.o -c src/qt/bitcoin-qt-base_autogen/mocs_compilation.cpp
In file included from src/qt/bitcoin-qt-base_autogen/mocs_compilation.cpp:20:
In file included from src/qt/bitcoin-qt-base_autogen/EWIEGA46WW/moc_notificator.cpp:10:
src/qt/bitcoin-qt-base_autogen/EWIEGA46WW/../../../../../../src/qt/notificator.h:59:9: error: declaration shadows a variable in the global namespace [-Werror,-Wshadow]
        None, /**< Ignore informational notifications, and show a modal pop-up
        ^
../../src/./net_permissions.h:18:5: note: previous declaration is here
    None = 0,
    ^
In file included from src/qt/bitcoin-qt-base_autogen/mocs_compilation.cpp:43:
In file included from src/qt/bitcoin-qt-base_autogen/EWIEGA46WW/moc_transactionview.cpp:10:
src/qt/bitcoin-qt-base_autogen/EWIEGA46WW/../../../../../../src/qt/transactionview.h:44:9: error: declaration shadows a variable in the global namespace [-Werror,-Wshadow]
        All,
        ^
../../src/./net_permissions.h:44:5: note: previous declaration is here
    All = BloomFilter | ForceRelay | Relay | NoBan | Mempool | Download |
    ^
2 errors generated.
[508/538] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/signverifymessagedialog.cpp.o
[509/538] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/intro.cpp.o
[510/538] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/transactiondescdialog.cpp.o
[511/538] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/transactionfilterproxy.cpp.o
[512/538] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/transactionrecord.cpp.o
[513/538] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/transactiontablemodel.cpp.o
[514/538] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/transactionview.cpp.o
[515/538] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/trafficgraphwidget.cpp.o
[516/538] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/optionsdialog.cpp.o
[517/538] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/walletframe.cpp.o
[518/538] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/splashscreen.cpp.o
[519/538] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/paymentrequestplus.cpp.o
[520/538] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/walletmodeltransaction.cpp.o
[521/538] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/optionsmodel.cpp.o
[522/538] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/guiutil.cpp.o
[523/538] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/bitcoin.cpp.o
[524/538] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/qrc_bitcoin_locale.cpp.o
[525/538] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/rpcconsole.cpp.o
[526/538] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/transactiondesc.cpp.o
[527/538] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/walletview.cpp.o
FAILED: src/qt/CMakeFiles/bitcoin-qt-base.dir/walletview.cpp.o 
/usr/bin/ccache /usr/bin/clang++ -DBOOST_AC_USE_STD_ATOMIC -DBOOST_ALL_NO_LIB -DBOOST_ATOMIC_DYN_LINK -DBOOST_FILESYSTEM_DYN_LINK -DBOOST_SP_USE_STD_ATOMIC -DBOOST_THREAD_DYN_LINK -DBUILD_BITCOIN_INTERNAL -DENABLE_AVX2 -DENABLE_SHANI -DENABLE_SSE41 -DHAVE_BUILD_INFO -DHAVE_CONFIG_H -DHAVE_CONSENSUS_LIB -DHAVE_DECL_EVP_MD_CTX_NEW=1 -DLEVELDB_ATOMIC_PRESENT -DLEVELDB_PLATFORM_POSIX -DOS_LINUX -DQT_CORE_LIB -DQT_DBUS_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DUSE_PROTOBUF_MESSAGE_BYTESIZELONG -Isrc/qt/bitcoin-qt-base_autogen/include -I../../src/. -Isrc -I../../src/univalue/include -Isrc/crypto/.. -I../../src/secp256k1/include -I../../src/leveldb/include -isystem /usr/include/jemalloc -isystem /usr/include/miniupnpc -isystem /usr/include/x86_64-linux-gnu/qt5 -isystem /usr/include/x86_64-linux-gnu/qt5/QtWidgets -isystem /usr/include/x86_64-linux-gnu/qt5/QtGui -isystem /usr/include/x86_64-linux-gnu/qt5/QtCore -isystem /usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++ -isystem /usr/include/x86_64-linux-gnu/qt5/QtNetwork -isystem /usr/include/x86_64-linux-gnu/qt5/QtDBus -Werror -g -O2 -fPIC -fvisibility=hidden -fstack-protector-all -Wstack-protector -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -Wall -Wextra -Wformat -Wgnu -Wvla -Wcast-align -Wunused-parameter -Wmissing-braces -Wthread-safety -Wrange-loop-analysis -Wredundant-decls -Wunreachable-code-loop-increment -Wsign-compare -Wconditional-uninitialized -Wdocumentation -Wformat-security -Wredundant-move -Woverloaded-virtual -Wshadow -Wshadow-field -Wno-unused-parameter -Wno-implicit-fallthrough -Wno-psabi -pthread -fPIC -std=gnu++17 -MD -MT src/qt/CMakeFiles/bitcoin-qt-base.dir/walletview.cpp.o -MF src/qt/CMakeFiles/bitcoin-qt-base.dir/walletview.cpp.o.d -o src/qt/CMakeFiles/bitcoin-qt-base.dir/walletview.cpp.o -c ../../src/qt/walletview.cpp
In file included from ../../src/qt/walletview.cpp:24:
../../src/./qt/transactionview.h:44:9: error: declaration shadows a variable in the global namespace [-Werror,-Wshadow]
        All,
        ^
../../src/./net_permissions.h:44:5: note: previous declaration is here
    All = BloomFilter | ForceRelay | Relay | NoBan | Mempool | Download |
    ^
1 error generated.
[528/538] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/walletmodel.cpp.o
[529/538] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/coincontroldialog.cpp.o
[530/538] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/sendcoinsdialog.cpp.o
[531/538] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/walletcontroller.cpp.o
[532/538] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/paymentserver.cpp.o
ninja: build stopped: cannot make progress due to previous errors.
Build build-clang failed with exit code 1
PiRK planned changes to this revision.Mar 14 2023, 10:28

I need to figure out the variable shadowing issue.

PiRK retitled this revision from scripted-diff: add NetPermissionFlags scopes where not already present and rename enumerators to scripted-diff: rename NetPermissionFlags enumerators.
PiRK edited the summary of this revision. (Show Details)

extract adding scope to D13326, rebase onto D13325 to avoid enum name conflicts (enum class is allowed to use same names as other enums, better encapsulation)

This revision is now accepted and ready to land.Mar 14 2023, 11:14