ned14 / pcpp

A C99 preprocessor written in pure Python
Other
215 stars 39 forks source link

Drop Python 2.7? #86

Closed mrolle45 closed 8 months ago

mrolle45 commented 8 months ago

I'd like to contribute some modest enhancements to pcpp. But I find that code that is Python 2 compatible is a nuisance to work with. I'd like to be able to use Python 3.7 (at least) features.

Questions for you, Ned:

  1. Do you think anyone would be using pcpp with Python 2.7 anymore?
  2. How would you publish 3.7-only code on PyPI and still make the current code available? I'm not familiar with using PyPI to publish code. I suppose there's a way to make the code version dependent so that "pip install pcpp" would magically pull in the right version to match the Python version running pip.
  3. How would you distinguish the two versions on GitHub. My idea is that you would create a "Python 2.7" branch off the current "main" and then merge my stuff onto the main branch. Also update README page to say that it is now requiring 3.7, and have a link to the 2.7 branch for those who want it.

Please let me know right away at m@rolle.name, so I can know whether I could use 3.7 features or not. Thanks.

mrolle45 commented 8 months ago

FYI, the enhancements I'm working on are in the area of diagnostic logging. Even if my changes don't get published, I'll use my code to diagnose some C code of mie that makes heavy use of macros, and I want to understand how the C99 Standard is being applied to their expansion (so that I can get the expansion that I want).

  1. Making the pcpp_debug.log file easier to read.
  2. Using indentation to frame #include'd files, sections controlled by #if and friends, and macro expansion.
  3. Show macro expansions and the steps involved therein.
  4. An optional filename for the --debug switch.
  5. A -v repeatable switch to control the level of verbosity of the log output.

I'd also like to include comments in the preprocessed output, as GCC does, with -C and -CC switches.