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

Add error emitting when we can't resolve id expr #2895

Merged
merged 2 commits into from Mar 4, 2024

Conversation

badumbatish
Copy link
Contributor

@badumbatish badumbatish commented Mar 1, 2024

gcc/rust/ChangeLog:

* resolve/rust-late-name-resolver-2.0.cc (Late::visit): Add error emitting

From issue #2876 , I clone gcc locally, then run from build dir

 ../gcc_src/configure '--with-pkgversion=basepoints/gcc-14-9118-g3232ebd91ed, built at 1708915534' --prefix=/tmp/gcc-x86_64-linux --enable-werror-always --enable-languages=rust --disable-gcov --disable-shared --disable-threads --target=x86_64-linux --without-headers --disable-multilib

to verify the crash.

Then i edit in-place of the recently cloned gcc the file rust-late-name-resolver-2.0.cc until the problem regarding the file goes away after rebuilding. The rest of the errors are in gcc error itself

../../gcc_src/gcc/gcc.cc: In function ‘void read_specs(const char*, bool, bool)’:
../../gcc_src/gcc/gcc.cc:2413:32: error: unknown conversion type character ‘t’ in format [-Werror=format=]
 2413 |                              "%td characters", p1 - buffer + 1);
      |                                ^
../../gcc_src/gcc/gcc.cc:2412:30: error: too many arguments for format [-Werror=format-extra-args]
 2412 |                              "specs %%include syntax malformed after "
      |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 2413 |                              "%td characters", p1 - buffer + 1);
      |                              ~~~~~~~~~~~~~~~~
../../gcc_src/gcc/gcc.cc:2433:32: error: unknown conversion type character ‘t’ in format [-Werror=format=]
 2433 |                              "%td characters", p1 - buffer + 1);
      |                                ^
../../gcc_src/gcc/gcc.cc:2432:30: error: too many arguments for format [-Werror=format-extra-args]
 2432 |                              "specs %%include syntax malformed after "
      |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 2433 |                              "%td characters", p1 - buffer + 1);
      |                              ~~~~~~~~~~~~~~~~
../../gcc_src/gcc/gcc.cc:2459:32: error: unknown conversion type character ‘t’ in format [-Werror=format=]
 2459 |                              "%td characters", p1 - buffer);
      |                                ^
../../gcc_src/gcc/gcc.cc:2458:30: error: too many arguments for format [-Werror=format-extra-args]
 2458 |                              "specs %%rename syntax malformed after "
      |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 2459 |                              "%td characters", p1 - buffer);
      |                              ~~~~~~~~~~~~~~~~
../../gcc_src/gcc/gcc.cc:2468:32: error: unknown conversion type character ‘t’ in format [-Werror=format=]
 2468 |                              "%td characters", p2 - buffer);
      |                                ^
../../gcc_src/gcc/gcc.cc:2467:30: error: too many arguments for format [-Werror=format-extra-args]
 2467 |                              "specs %%rename syntax malformed after "
      |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 2468 |                              "%td characters", p2 - buffer);
      |                              ~~~~~~~~~~~~~~~~
../../gcc_src/gcc/gcc.cc:2478:32: error: unknown conversion type character ‘t’ in format [-Werror=format=]
 2478 |                              "%td characters", p2 - buffer);
      |                                ^
../../gcc_src/gcc/gcc.cc:2477:30: error: too many arguments for format [-Werror=format-extra-args]
 2477 |                              "specs %%rename syntax malformed after "
      |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 2478 |                              "%td characters", p2 - buffer);
      |                              ~~~~~~~~~~~~~~~~
../../gcc_src/gcc/gcc.cc:2488:32: error: unknown conversion type character ‘t’ in format [-Werror=format=]
 2488 |                              "%td characters", p3 - buffer);
      |                                ^
../../gcc_src/gcc/gcc.cc:2487:30: error: too many arguments for format [-Werror=format-extra-args]
 2487 |                              "specs %%rename syntax malformed after "
      |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 2488 |                              "%td characters", p3 - buffer);
      |                              ~~~~~~~~~~~~~~~~
../../gcc_src/gcc/gcc.cc:2527:59: error: unknown conversion type character ‘t’ in format [-Werror=format=]
 2527 |                          "specs unknown %% command after %td characters",
      |                                                           ^
../../gcc_src/gcc/gcc.cc:2527:26: error: too many arguments for format [-Werror=format-extra-args]
 2527 |                          "specs unknown %% command after %td characters",
      |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../gcc_src/gcc/gcc.cc:2539:51: error: unknown conversion type character ‘t’ in format [-Werror=format=]
 2539 |                      "specs file malformed after %td characters",
      |                                                   ^
../../gcc_src/gcc/gcc.cc:2539:22: error: too many arguments for format [-Werror=format-extra-args]
 2539 |                      "specs file malformed after %td characters",
      |                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../gcc_src/gcc/gcc.cc:2553:51: error: unknown conversion type character ‘t’ in format [-Werror=format=]
 2553 |                      "specs file malformed after %td characters",
      |                                                   ^
../../gcc_src/gcc/gcc.cc:2553:22: error: too many arguments for format [-Werror=format-extra-args]
 2553 |                      "specs file malformed after %td characters",
      |                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors
make[1]: *** [Makefile:1198: gcc.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: Leaving directory '/home/jjasmine/clone_dir/gcc/gcc_build/gcc'
make: *** [Makefile:5044: all-gcc] Error 2

I then transfer the newly edited portion to the gccrs codebase

Copy link
Member

@CohenArthur CohenArthur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks :D

Comment on lines 133 to 136
else {
rust_error_at(expr.get_locus (), "could not resolve identifier expression: %qs", expr.get_ident ().as_string ().c_str ());
return;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that looks great - for style issues, could you also add braces to the above if and else if statements? this way the else one isn't the only one with braces and it looks more uniform.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, i'll get on it soon

@badumbatish
Copy link
Contributor Author

I mistyped cp ./contrib/clang-format ./clang-format instead of cp ./contrib/clang-format ./.clang-format on the src folder. Was wondering why it can't catch these formatting errors locally

@badumbatish badumbatish force-pushed the building_upstream_warning branch 2 times, most recently from bfe2c62 to 3e993c9 Compare March 1, 2024 21:54
gcc/rust/ChangeLog:

	* resolve/rust-late-name-resolver-2.0.cc (Late::visit): Add error emitting
gcc/rust/ChangeLog:

	* resolve/rust-late-name-resolver-2.0.cc (Late::visit): Add error emitting
@badumbatish
Copy link
Contributor Author

badumbatish commented Mar 2, 2024

I fetched master from upstream and then rebase onto my branch so that the content matched this repository's master, not sure if there's any other way to have github not show false information that I actually modified 62 files???

@CohenArthur
Copy link
Member

I fetched master from upstream and then rebase onto my branch so that the content matched this repository's master, not sure if there's any other way to have github not show false information that I actually modified 62 files???

it's showing me 1 file changed, so I think everything's good :) sometimes after a rebase the github frontend lags behind and takes a while to update. the commit list can also get messed up

Copy link
Member

@CohenArthur CohenArthur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for taking care of this :) LGTM!

@CohenArthur CohenArthur added this pull request to the merge queue Mar 4, 2024
Merged via the queue into Rust-GCC:master with commit ede65c2 Mar 4, 2024
9 checks passed
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

Successfully merging this pull request may close these issues.

None yet

2 participants