aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/resolve
diff options
context:
space:
mode:
authorMarc Poulhiès <dkm@kataplop.net>2023-07-12 19:00:10 +0200
committerMarc Poulhiès <dkm@kataplop.net>2023-08-02 10:04:20 +0000
commit36db4d9539ed49c6fb6002408065f3bad734f866 (patch)
treea80563b3024ea2045fb8550a8917791f82c171e4 /gcc/rust/resolve
parentb7c5b50a4e6cbaf812112ee0a587bb129dca1a54 (diff)
downloadgcc-36db4d9539ed49c6fb6002408065f3bad734f866.zip
gcc-36db4d9539ed49c6fb6002408065f3bad734f866.tar.gz
gcc-36db4d9539ed49c6fb6002408065f3bad734f866.tar.bz2
gccrs: better handling of incorrect file loading in include_* builtin macros
When the load_file_bytes() fails to open the file, it emits an error but returns an empty vector (as if the file is empty). Instead, return a tl::optional nullopt in case of error and an empty vector in case of an empty file. fixes #2421 gcc/rust/ChangeLog: * expand/rust-macro-builtins.cc (load_file_bytes): Return a tl::optional. (MacroBuiltin::include_byte_handler): Adjust and check file was correctly opened. (MacroBuiltin::include_str_handler): Likewise. gcc/testsuite/ChangeLog: * rust/compile/empty_file: New file. * rust/compile/issue-2421_str.rs: New test. Signed-off-by: Marc Poulhiès <dkm@kataplop.net>
Diffstat (limited to 'gcc/rust/resolve')
0 files changed, 0 insertions, 0 deletions