Preprocessor Options

I’m trying to replicate a preprocessing stage that currently is done with gcc (flag -E).

Apparently the ‘-E’ pgcc behaviour is to output the preprocessed code to stdout. In gcc instead you can use a ‘-o’ flag to control where to put the preprocessed code but in pgcc I haven’t been able to achieve the same behaviour. Is that possible?

pgcc also seem’s to have the ‘-P’ flag that stores the output into a ‘*.i’ file.
But ‘-o’ doesn’t seem to affect at all.

My question, then is. Is it possible to preprocess with pgcc specifiying the output location without having to rename the results (with ‘mv’ or redirecting stdout) etc… [just to make my life easier]

Thanks

Reading the pgcc documentation I’m starting to think that it’s a bug.

From ‘man pgcc’

Overall Options

-o file Use file as the name of the executable program, rather than the default a.out. If used with -c, -P, or -S, and a single input file, file is used as the name of the object,
preprocessor, or assembler output file.

Preprocessor Options

-P Preprocess each file and leave the output in a file named file.i for each file named file.c.

Then preprocessing a .c file with -P and adding -o to specify the output location should be valid!
But apparently doesn’t work:

Example:
File hello.c

#include <stdio.h>

void main()
{
    printf("Hello World!\n");
}

Preprocess hello.c:

$ ls
hello.c
$ pgcc -P -o preprocessed_file hello.c
$ ls
hello.c hello.i

But instead of preprocessed_file we got hello.i !!!

pgcc 16.10-0 64-bit target on x86-64 Linux -tp haswell
The Portland Group - PGI Compilers and Tools
Copyright © 2016, NVIDIA CORPORATION. All rights reserved.

I have logged this problem as TPR 24140.

The workaround can be

pgcc -E hello.c >& preprocessed_file

dave