develooper Front page | perl.perl5.changes | Postings from November 2022

[Perl/perl5] a77af1: embed.fnc - expand comment about exportingsymbols

From:
Yves Orton via perl5-changes
Date:
November 14, 2022 19:25
Subject:
[Perl/perl5] a77af1: embed.fnc - expand comment about exportingsymbols
Message ID:
Perl/perl5/push/refs/heads/yves/implicit_hek_key/000000-a2682d@github.com
  Branch: refs/heads/yves/implicit_hek_key
  Home:   https://github.com/Perl/perl5
  Commit: a77af1f57b602c368bf2bf66a77e8e7591702957
      https://github.com/Perl/perl5/commit/a77af1f57b602c368bf2bf66a77e8e7591702957
  Author: Yves Orton <demerphq@gmail.com>
  Date:   2022-11-13 (Sun, 13 Nov 2022)

  Changed paths:
    M embed.fnc

  Log Message:
  -----------
  embed.fnc - expand comment about exporting symbols


  Commit: a2682da36c446800e9cd86b7beb2db3d666bdb8c
      https://github.com/Perl/perl5/commit/a2682da36c446800e9cd86b7beb2db3d666bdb8c
  Author: Yves Orton <demerphq@gmail.com>
  Date:   2022-11-14 (Mon, 14 Nov 2022)

  Changed paths:
    M hv.c
    M hv.h
    M sv.h

  Log Message:
  -----------
  hv.h - remove hek_key and make it implicit

Having something like this:

    struct foo {
        UV flags;
        UV len;
        char str[0];
    };
    #define STR(x) x->str

which is the overallocated to provide the required space to the char array
confuses compilers smart enough to do bound checking. We should be able to
avoid this by simply removing the str[] array as an explicit member, and the
making it a "virtual" member determined by the location of the struct and its
size. In theory this should appease gcc 12. Thus we would end up with

    struct foo {
        UV flags;
        UV len;
    };
    #define STR(x) (((char*)x)+sizeof(struct foo))

For hek_key at least the code already has macros which make this easy to do.


Compare: https://github.com/Perl/perl5/compare/a77af1f57b60%5E...a2682da36c44



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About