RE: [PATCH 00/11] pragma once: treewide conversion

From: David Laight
Date: Thu Mar 04 2021 - 08:57:55 EST


> (a) the traditional include guard optimization HAS NO HIDDEN SEMANTIC
> MEANING. It's a pure optimization that doesn't actually change
> anything else. If you don't do the optimization, absolutely nothing
> changes.

And if the parser is well written the optimisation is probably
irrelevant compared to the compile time.

OTOH that probably requires using mmap(), memchr('\n') to look
for line starts, a fast search for '[ ]*#' followed by else/endif
and a final horrid backwards check for a continuation line.

That optimisation will generally speed up header file processing.

David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)