Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot scan libwebp due to parenthesis level check #63

Open
RomanValov opened this issue Oct 11, 2022 · 4 comments
Open

Cannot scan libwebp due to parenthesis level check #63

RomanValov opened this issue Oct 11, 2022 · 4 comments

Comments

@RomanValov
Copy link

Hi,

this is follow up of #57 . The fix provided doesn't help for all projects I use.
In particular running cpp-dependecies over libwebp causes the issue:

$ cpp-dependencies --stats
final level of parentheses=7
cpp-dependencies: /build/cpp-dependencies/parts/cpp-depenencies/src/src/Input.cpp:310: void ReadCmakelist(const Configuration&, std::unordered_map<std::__cxx11::basic_string<char>, Component*>&, const boost::filesystem::path&): Assertion `parenLevel == 0 || (printf("final level of parentheses=%d\n", parenLevel), 0)' failed.
Aborted (core dumped)

Project code:

https://github.com/webmproject/libwebp / tag v1.2.4 (current HEAD also fails)

It worth noting that before the #61 final level of parentheses was 1 (not 7).
And it was possible to overcome the issue by modifying following line in CMakeLists.txt of libwebp:

405: "AC_INIT\\([^\n]*\\[[0-9\\.]+\\]"

to

405: "AC_INIT\\([^\n]*\\[[0-9\\.]+\\]\\)"

With recent changes this no longer works.

@PeterBindels-TomTom
Copy link
Collaborator

Can you check now? This fix handles continued lines which the webp cmakelists uses in 7 places. Funnily enough the fix for #57 does actually fix that AC_INIT (that's the exact misparse it's fixing - paren imbalance inside a string) - but it didn't handle multiline strings yet. I didn't know cmake allowed that.

@RomanValov
Copy link
Author

Thanks @PeterBindels-TomTom . Build from dascandy/cpp-dependencies fixes the issue with libwebp.

However have you mentioned that cpp-dependencies self scan is broken since f7fba9a ?

$ git remote -v
origin	https://github.com/dascandy/cpp-dependencies.git (fetch)
origin	https://github.com/dascandy/cpp-dependencies.git (push)
$ git status
On branch master
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean
$ cmake .
-- The CXX compiler identification is GNU 11.2.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test PEDANTIC_SUPPORTED
-- Performing Test PEDANTIC_SUPPORTED - Success
-- Found Boost: /usr/lib/x86_64-linux-gnu/cmake/Boost-1.74.0/BoostConfig.cmake (found version "1.74.0") found components: filesystem system 
-- Found Git: /usr/bin/git (found version "2.34.1") 
-- Git reported this project's version as '1.0-179-g3036c3a'
-- Configuring done
-- Generating done
-- Build files have been written to: /home/reddot/custom/rugiex/tmp/cpp-dependencies
$ make
[  6%] Building CXX object src/CMakeFiles/cpp_dependencies_lib.dir/Analysis.cpp.o
[ 12%] Building CXX object src/CMakeFiles/cpp_dependencies_lib.dir/CmakeRegen.cpp.o
[ 18%] Building CXX object src/CMakeFiles/cpp_dependencies_lib.dir/Component.cpp.o
[ 25%] Building CXX object src/CMakeFiles/cpp_dependencies_lib.dir/Configuration.cpp.o
[ 31%] Building CXX object src/CMakeFiles/cpp_dependencies_lib.dir/generated.cpp.o
[ 37%] Building CXX object src/CMakeFiles/cpp_dependencies_lib.dir/Input.cpp.o
[ 43%] Building CXX object src/CMakeFiles/cpp_dependencies_lib.dir/Output.cpp.o
[ 50%] Linking CXX static library libcpp_dependencies_lib.a
[ 50%] Built target cpp_dependencies_lib
[ 56%] Building CXX object src/CMakeFiles/cpp-dependencies.dir/main.cpp.o
[ 62%] Linking CXX executable cpp-dependencies
[ 62%] Built target cpp-dependencies
[ 68%] Building CXX object test/CMakeFiles/unittests.dir/AnalysisCircularDependencies.cpp.o
[ 75%] Building CXX object test/CMakeFiles/unittests.dir/CmakeRegenTest.cpp.o
[ 81%] Building CXX object test/CMakeFiles/unittests.dir/ConfigurationTest.cpp.o
[ 87%] Building CXX object test/CMakeFiles/unittests.dir/InputTest.cpp.o
[ 93%] Building CXX object test/CMakeFiles/unittests.dir/test.cpp.o
[100%] Linking CXX executable unittests
[100%] Built target unittests
$ ./src/cpp-dependencies --stats
final level of parentheses=1
cpp-dependencies: /home/reddot/custom/rugiex/tmp/cpp-dependencies/src/Input.cpp:316: void ReadCmakelist(const Configuration&, std::unordered_map<std::__cxx11::basic_string<char>, Component*>&, const boost::filesystem::path&): Assertion `parenLevel == 0 || (printf("final level of parentheses=%d\n", parenLevel), 0)' failed.
Aborted (core dumped)

@PeterBindels-TomTom
Copy link
Collaborator

Didn't notice that, no. According to the documentation I'm doing something that's not legal cmake either.

@RomanValov
Copy link
Author

Here are some observations when running cpp-dependencies over components of the project I'm working with:

message("OKAY")

message(STATUS "
  NOT OKAY
")

#message(STATUS "
#  OKAY
#")

  #message(STATUS "
  #  NOT OKAY
  #")

if(1)
  message(STATUS "
    NOT OKAY
  ")
endif()

#if(1)
#message(STATUS "
#  OKAY
#")
#endif()

#if(1)
  #message(STATUS "
  #  NOT OKAY
  #")
#endif()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants