diff options
author | Jakub Jelinek <jakub@redhat.com> | 2024-09-12 11:34:06 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2024-09-12 11:34:06 +0200 |
commit | 44058b847145166715f15e49fa8854f30e852f24 (patch) | |
tree | 6a05f67450a55752b5494c725d0cc982d0d6cc72 /libcpp/internal.h | |
parent | eba6d2aa71a9b59386e5a2453cbe924371626b0b (diff) | |
download | gcc-44058b847145166715f15e49fa8854f30e852f24.zip gcc-44058b847145166715f15e49fa8854f30e852f24.tar.gz gcc-44058b847145166715f15e49fa8854f30e852f24.tar.bz2 |
libcpp: Add support for gnu::offset #embed/__has_embed parameter
The following patch adds on top of the just posted #embed patch
a first extension, gnu::offset which allows to seek in the data
file (for seekable files, otherwise read and throw away).
I think this is useful e.g. when some binary data start with
some well known header which shouldn't be included in the data etc.
2024-09-12 Jakub Jelinek <jakub@redhat.com>
libcpp/
* internal.h (struct cpp_embed_params): Add offset member.
* directives.cc (EMBED_PARAMS): Add gnu::offset entry.
(enum embed_param_kind): Add NUM_EMBED_STD_PARAMS.
(_cpp_parse_embed_params): Use NUM_EMBED_STD_PARAMS rather than
NUM_EMBED_PARAMS when parsing standard parameters. Parse gnu::offset
parameter.
* files.cc (struct _cpp_file): Add offset member.
(_cpp_stack_embed): Handle params->offset.
gcc/
* doc/cpp.texi (Binary Resource Inclusion): Document gnu::offset
#embed parameter.
gcc/testsuite/
* c-c++-common/cpp/embed-15.c: New test.
* c-c++-common/cpp/embed-16.c: New test.
* gcc.dg/cpp/embed-5.c: New test.
Diffstat (limited to 'libcpp/internal.h')
-rw-r--r-- | libcpp/internal.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libcpp/internal.h b/libcpp/internal.h index ff49c28..ad0625a 100644 --- a/libcpp/internal.h +++ b/libcpp/internal.h @@ -637,7 +637,7 @@ struct cpp_embed_params { location_t loc; bool has_embed; - cpp_num_part limit; + cpp_num_part limit, offset; cpp_embed_params_tokens prefix, suffix, if_empty; }; |