gcc’s ‘#pragma once’ accounts for file timestamp and contents but not name

Nota Bene: gcc’s #pragma once takes into account the file timestamp and the file contents but does not take into account the file name or position in the tree. This is unfortunate.


This can occur…

  • On very fast systems & filesystems such that file timestamps become “the same” (having the same per-second granularity).
  • [unusual] When files are copied OR
  • When files have substantially the same contents but because of their location in the build tree or searchpath, make visible different ancillary files.


  • 52566#include with #pragma once and files’ contents is the same