Hallo,

> I started wondering about the purpose of this line:
>     sed -i '233,237 s/max)/max \\/' lib/intprops.h

it seems that the surrounding #define is 0 in your case so you don't
encounter the bad macro definition. The sed introduces a syntax error,
too, so it seems noone ever evaluated that. Of course you can't replace
the closing parenthesis with a \\ to continue the line.

The lines look like this:

(the first one is #226 just to better show the context)

/* True if __builtin_add_overflow (A, B, P) works when P is null.  */
#define _GL_HAS_BUILTIN_OVERFLOW_WITH_NULL (7 <= __GNUC__)

You'd encounter the problem only when LFS moves to gcc >= version 7.

# echo "__GNUC__" | gcc -I. -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>"
6


#if _GL_HAS_BUILTIN_OVERFLOW_WITH_NULL
--> (the following line is # 233)
# define _GL_ADD_OVERFLOW(a, b, min, max)
   __builtin_add_overflow (a, b, (__typeof__ ((a) + (b)) *) 0)
# define _GL_SUBTRACT_OVERFLOW(a, b, min, max)
   __builtin_sub_overflow (a, b, (__typeof__ ((a) - (b)) *) 0)
# define _GL_MULTIPLY_OVERFLOW(a, b, min, max)
   __builtin_mul_overflow (a, b, (__typeof__ ((a) * (b)) *) 0)
#else

> I looked at lib/intprops.h and it didn't seem like there was a syntax error
> there.

Technically the old version not a syntax error, the macros are defined
as "existing" but not with the semantical contents that was intended.

I guess the intention was to write something like this

# define _GL_ADD_OVERFLOW(a, b, min, max) \\
   __builtin_add_overflow (a, b, (__typeof__ ((a) + (b)) *) 0)

and you'd need both ) and \\ to make it syntactically correct.

You can verify the parsed C code without macros, i.e. after all macros
have been replaced, when you apply gcc -E to your sourcecode (together
with all the switches and -D you'd usually use there).

When I use this technique the last line from intprops.h is # 84.

/sources/diffutils-3.5/lib # gcc -I. -E xstrtol.c | grep "intprop"
# 1 "intprops.h" 1
...
# 84 "intprops.h" 3 4
# 84 "intprops.h"

Tschau...Thomas
-- 
"Do you wanna be a legend or a passing footprint on the sands of time?"

Attachment: signature.asc
Description: OpenPGP digital signature

-- 
http://lists.linuxfromscratch.org/listinfo/lfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Do not top post on this list.

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

http://en.wikipedia.org/wiki/Posting_style

Reply via email to