[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug-patch] -D hell
From: |
Mattias Andrée |
Subject: |
[bug-patch] -D hell |
Date: |
Mon, 21 Mar 2016 11:57:20 +0100 |
User-agent: |
Claws Mail |
Hi again!
patch(1p) specifies for '-D define' that
If the patched file is processed with the C preprocessor,
where the macro 'define' is defined, the output shall contain
the changes from the patch file; otherwise, the output shall
not contain the patches specified in the patch file.
I interpret this as implying that a patched C must be at least
as syntactically correct after patching as before patching.
If you have two files:
1\
2
and
1\
new
2
If the former is patched with -Dx than the result is
1\
#ifdef x
new
#endif
2
Because of the backslash at the end of the first line that
result is not syntactically correct. Therefore, patch must
look out for line continuations and comments, and not be
fooled by /* that appear inside string literals.
Sincerely,
Mattias Andrée
pgppmwwT7QQ98.pgp
Description: OpenPGP digital signature
- [bug-patch] -D hell,
Mattias Andrée <=