How to get same Pre-processor output for aCC (Hp-Ux) and g++ (Linux)?

139 views Asked by At

I've scripts specifically written to perform certain actions on HpUx pre-processor output and get desired details.

  • HpUx-ia64.
  • Linux-x86_64.

Now I need to migrate the same to Linux. Instead of rewriting tool entirely for Linux, how can I get the g++ -E (linux) output same as that of hpux aCC -E on a sourcename.

1

There are 1 answers

0
Employed Russian On

Instead of rewriting tool entirely for Linux, how can I get the g++ -E (linux) output same as that of hpux aCC -E on a sourcename.

Short answer: no.

Longer answer: compilers generally don't care what the output of $compiler -E looks like, so long as it fairly accurately represents the program. Some compilers can't even compile the output of $compiler -E foo.cc when $compiler -c foo.cc works just fine (this is a bug, but a low priority one).

Any tool or script that works on the preprocessed file (that's your script) should accept valid preprocessed result. Insisting that all compilers produce exactly the same preprocessed output is pointless; it's just not going to happen.

Even longer answer: g++ is open source. If you believe that it's easier to fix g++ to match output of aCC than it is to fix your script to accept either input, you have the power to do so (but I predict that it's at least 1000 times harder to do the former than the latter).

Finally, you did not provide any details of what differences you are trying to eliminate. Had you done so, this (or some other) answer might have been more useful.