hsutter / cppfront

A personal experimental C++ Syntax 2 -> Syntax 1 compiler
Other
5.39k stars 232 forks source link

Fix possible division by zero when using -verbose #906

Closed oriyadid closed 7 months ago

oriyadid commented 8 months ago

I encountered an issue where using -verbose on a pure cpp2 file causes a floating point exception, as there are zero cpp1 lines, this PR fixes it.

To reproduce you may compile this simple file (or any other pure cpp2 file) with -verbose, other flags don't matter:

main: () -> int = {
  return 0;
}
hsutter commented 8 months ago

Thanks for your pull request! It looks like this may be your first contribution to cppfront. I've sent the Contributor License Agreement (CLA) to your email, and once it's signed I can look at your pull request. Thanks again for your contribution.

oriyadid commented 8 months ago

I've now signed the CLA, thanks.

hsutter commented 7 months ago

Thanks!