This is the mail archive of the gcc-patches@gcc.gnu.org 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]

SED is ugly stuff...


In the process of looking at the machine name fixing,
I took a closer look at how the '#if...' "pattern space"
gets constructed.  Silly me :-(.

Here is the sed `loop':

  :loop
  /\\$/N
  s/\\$/\\+++fixinc_eol+++/
  /\\$/b loop
  s/\\+++fixinc_eol+++/\\/g

It did not look to me like it would work, and it does not.
The "fixinc_eol" commands (almost) never apply because the '$'
addresses the end of the pattern space, not the end of line.
`sed(1)' refers you to `ed(1)' for understanding regular
expressions, but in this context you end up misinformed.
Furthermore, it is a no-op.  Unless someone objects, I propose
the following replacement:

  :loop
  /\\$/ {
    N
    b loop
  }

If there really is a sed out there that uses '$' to
mean end-of-line instead of end-of-pattern, then I
suggest:

  :loop
  /\\$/ {
    s/\\$/\\+++fixinc_eol+++/g
    N
    b loop
  }
  s/+++fixinc_eol+++//g

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