Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 634782 - toolchain-funcs.eclass, fix definition of tc-getCPP
Summary: toolchain-funcs.eclass, fix definition of tc-getCPP
Status: RESOLVED WONTFIX
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Eclasses (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-10-19 15:35 UTC by Joakim Tjernlund
Modified: 2018-04-29 16:50 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Joakim Tjernlund 2017-10-19 15:35:20 UTC
Currently tc-getCPP is defined
 tc-getCPP() { tc-getPROG CPP "${CC:-gcc} -E" "$@"; }
This breaks an scripts trying to pipe input:
  echo "main(){}" |  tc-getCPP
as gcc -E does not accept piped data

Changing tc-getCPP to
 tc-getCPP() { tc-getPROG CPP cpp "$@"; }
fixes that.
Any reason to keep this old definition of tc-getCPP ?
Comment 1 Mike Gilbert gentoo-dev 2017-10-28 16:19:50 UTC
> as gcc -E does not accept piped data

Sure it does:

% echo "int main(){return 0;}" | gcc -E -
# 1 "<stdin>"
# 1 "<built-in>"
# 1 "<command-line>"
# 31 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 32 "<command-line>" 2
# 1 "<stdin>"
int main(){return 0;}

> Any reason to keep this old definition of tc-getCPP ?

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c65f6083898968b5442eeb66afd4298a3b4264e2
Comment 2 Joakim Tjernlund 2017-10-29 11:43:13 UTC
(In reply to Mike Gilbert from comment #1)
> > as gcc -E does not accept piped data
> 
> Sure it does:
> 
> % echo "int main(){return 0;}" | gcc -E -
> # 1 "<stdin>"
> # 1 "<built-in>"
> # 1 "<command-line>"
> # 31 "<command-line>"
> # 1 "/usr/include/stdc-predef.h" 1 3 4
> # 32 "<command-line>" 2
> # 1 "<stdin>"
> int main(){return 0;}

But this requiers you to know that cpp is really gcc.
> 
> > Any reason to keep this old definition of tc-getCPP ?
> 
> https://gitweb.gentoo.org/repo/gentoo.git/commit/
> ?id=c65f6083898968b5442eeb66afd4298a3b4264e2

I see, not an easy fix then.