This adds support for function-like definitions in this script, at the
same time that fixes support for normal definitions done over multiple
lines, which was not working as intented with the previous regexp.
Resolves https://github.com/brave/brave-browser/issues/17937
To make this work well on shells like Windows' cmd.exe or PowerShell,
we add an intermediate step before matching the paths for files found
in the repository against the regular expresisons declared in EXCLUDES,
so that we use forward slashes instead of backward slashes, which will
cause errors due to the regexp interpreting paths like C:\\mypath as if
they contained the escaped '\m' character.
Once the regular expression has been used though, we still append the
unnormalized OS-dependant relative path to the list of paths built by
filter_chromium_src_filepaths(), so that further operations over those
files can be performed correctly, and so that any path printed in the
output will use the OS-dependant path separator.
To make it clearer where each global variable points to, rename:
* SOURCE_ROOT -> BRAVE_SRC
* CHROMIUM_SRC -> BRAVE_CHROMIUM_SRC
* SRC_DIR -> CHROMIUM_SRC
We can't use the OS path separator when handling C++ include paths but
UNIX-like path separators instead, otherwise counting the number of
'../' components wont' work, nor creating the list of relative paths
to chromium_src override files to be checked.
We would like to expand the functionality of this script to allow us
to check for more potentially problematic situations (e.g. new uses
of re-defined symbols inside a given overriden file), so let's migrate
it to Python first so that's easier to extend.
Resolves https://github.com/brave/brave-browser/issues/14382