Subject: bug#48264: [PATCH v3 15/15] Add and use BVAR_FIELD macros

From: Spencer Baugh <[email-masked]>
Date: Sun, 9 May 2021 13:09:31 -0400

Eli Zaretskii <[email-masked]> writes:
>> From: Spencer Baugh <[email-masked]>
>> Cc: [email-masked]
>> Date: Sat, 08 May 2021 15:03:46 -0400
>> 
>> Eli Zaretskii <[email-masked]> writes:
>> >> From: Spencer Baugh <[email-masked]>
>> >> Cc: [email-masked]
>> >> Date: Sat, 08 May 2021 09:35:31 -0400
>> >> If you think such a conditionally-compiled runtime check would be
>> >> acceptable for applying these changes, I can go ahead and write that.
>> >
>> > Yes, I think so.  But if Lars or Stefan think differently, I might
>> > reconsider.
>> 
>> In the process of implementing the runtime check, I, of course, came up
>> with a better compile-time check. How about this?
>
> LGTM, thanks.  But could you please run your benchmarks again, with
> this implementation, to make sure we still get only a 1 - 2% slowdown
> at worst?  I wouldn't expect the addition to matter in an optimized
> build, but just to be sure...

I ran the benchmarks again and got similar results.

|                       |    On master | With my changes | Slowdown |
| shr-bench             | 2.2865667967 |    2.2762716187 |   -0.48% |
| delete *.elc and make |   52m12.627s |      51m56.780s |   -0.50% |
| xdisp-bench           | 6.1960484849 |    6.2269325793 |    0.49% |

Here's the two patches that are needed to add this compile-time check;
they apply cleanly on my v4 series, when the "Add and use BVAR_FIELD
macros" patch is removed.

Spencer Baugh (2):
  Take buffer field name in DEFVAR_PER_BUFFER
  Add compile-time check that BVAR is used correctly

 src/buffer.c   | 140 ++++++++++++++++++++++++-------------------------
 src/buffer.h   |  28 ++++++++--
 src/category.h |   2 +-
 src/syntax.h   |   2 +-
 4 files changed, 94 insertions(+), 78 deletions(-)

-- 
2.31.1