This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: How to compare two text files? Using sed, cmp, diff, tr?

Quoting Georg-Johann Lay <>:

The avr backend auto-generates parts of GCC's texi documentation,
namely the supported -mmcu= options, which are about 200.

I hope that autogenerated documentation is still helpful then. Sometimes an overabundance of verbose documentation can prevent a user from finding what (s)he needs.

The sed -e 's:\r::g' from above that tries to fix line endings has the
problem that not all sed implementations are the same, i.e. some just do
sed -e 's:r::g' and remove all r's.

I searched some time how to accomplish this but did not find a neat solution.

Can tr from roff be used? Is it a valid prerequisite for GCC?

tr is already used in a number of places in Note that there is a distinction between tools required to rebuild auto-generated files, and tool required to build GCC assuming all auto-generated files are up-to-date. You should make it so that tr is not used if the timestamps indicate that the documentation is up-to-date.

Look for the s-tm-texi rule in, it normalizes the line ending
using tr (while taking care of a Solaris oddity), before comparing it to
the existing version.

Or open a binary file to write the test instead of printf+stdout?

That just shifts the portability issues to how to open a file for binary writing. Not all platforms support open(2). Some platforms need "b" for fopen, others reject it. And then you have to make sure that what you write really makes sense for binary writing on all platforms, when you naturally describe the data as text.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]