khiops icon indicating copy to clipboard operation
khiops copied to clipboard

Stop Outputting `#line` directives in Flex and Bison Output `.cpp`/ `.h` Files

Open popescu-v opened this issue 1 year ago • 1 comments

Description

Currently, #line preprocessor directives with absolute paths are outputted in the following files:

	src/Learning/KWData/KWCLex.inc
	src/Learning/KWData/KWCYac.cpp
	src/Learning/KWData/KWCYac.hpp
	src/Norm/base/JSONLex.inc
	src/Norm/base/JSONYac.cpp
	src/Norm/base/JSONYac.hpp

These directives contain absolute paths, which:

  • can leak local machine-specific details
  • are not directly portable to other machines (for other developers).

Questions/Ideas

The goal of this issue is to add:

  • %noline option to Flex
  • %no-line option to Bison so that #line directives are not outputted anymore. These directives would only be used during development, on the local machine of the developer, but would not be committed anymore.

Context

  • Khiops version: >= 11
  • OS description (use khiops -s): All supported.

popescu-v avatar Dec 18 '24 18:12 popescu-v

3 stages:

  • add CMake option to generate these files w/o #line directives
  • document convention to generate these files w/o #line before committing them
  • add pre-commit hook to warn on the presence of #line directives in these files.

popescu-v avatar Jan 09 '25 15:01 popescu-v