Restrict check for obsolete macros to C++ code

Only check for the use of NULL in C++ code, not C, for example, where
it still can, and should, be used.

Also allow using "NULL" as part of a larger macro name (where it would
be followed by "_") or at the beginning/end of a string.
This commit is contained in:
Vadim Zeitlin 2023-04-17 18:30:32 +02:00
parent 83773cec9a
commit a0ea27cccf

View file

@ -87,8 +87,8 @@ jobs:
run: |
git fetch --depth=1 origin master
if git diff origin/master \
':!.github/workflows/code_checks.yml' \
| grep -E '^\+.*(wxOVERRIDE|wxNOEXCEPT|[^_@]NULL)'; then
':**.h' ':**.cpp' \
| grep -E '^\+.*(wxOVERRIDE|wxNOEXCEPT|[^"_@]NULL[^"_])'; then
echo "::error ::Please use C++11 equivalents of the deprecated macros in the new code."
exit 1
fi