summaryrefslogtreecommitdiffstats
path: root/scripts/unifdef.c
Commit message (Collapse)AuthorAgeFilesLines
* unifdef: use memcpy instead of strncpyLinus Torvalds2018-11-301-2/+2
| | | | | | | | | | | | | | New versions of gcc reasonably warn about the odd pattern of strncpy(p, q, strlen(q)); which really doesn't make sense: the strncpy() ends up being just a slow and odd way to write memcpy() in this case. There was a comment about _why_ the code used strncpy - to avoid the terminating NUL byte, but memcpy does the same and avoids the warning. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* unifdef: update to upstream version 2.5Tony Finch2011-01-221-63/+184
| | | | | | | | | | | | | Fix a long-standing cpp compatibility bug. The -DFOO argument (without an explicit value) should define FOO to 1 not to the empty string. Add a -o option to support overwriting a file in place, and a -S option to list the nesting depth of symbols. Include line numbers in debugging output. Support CRLF newlines. Signed-off-by: Tony Finch <dot@dotat.at> Signed-off-by: Michal Marek <mmarek@suse.cz>
* unifdef: update to upstream revision 1.190Tony Finch2009-12-121-134/+207
| | | | | | | | | | | | | | | | | Fix handling of input files (e.g. with no newline at EOF) that could make unifdef get into an unexpected state and call abort(). The new -B option compresses blank lines around a deleted section so that blank lines around "paragraphs" of code don't get doubled. The evaluator can now handle macros with arguments, and unbracketed arguments to the "defined" operator. Add myself to MAINTAINERS for unifdef. Signed-off-by: Tony Finch <dot@dotat.at> Acked-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Michal Marek <mmarek@suse.cz>
* kbuild: fix headers_exports with boolean expressionRussell King2009-06-091-11/+37
| | | | | | | | | | | | | | | | | | | | | When we had code like this in a header unifdef failed to deduct that the expression was always false - and we had code exported that was not intended for userspace. #if defined(__KERNEL__) && !defined(__ASSEMBLY__) int a; #endif This commit implment support in unidef which allows it to work out if an #if expression always evaluates true or false for symbols which are being undefined/always defined. The patch is slightly more complicated than I'd hoped because unifdef needs to see lines fully evaluated - doing otherwise causes it to mark the line as "dirty" and copy it over no matter what. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
* kbuild: fix C libary confusion in unifdef.c due to getline()Justin P. Mattock2009-03-071-3/+3
| | | | | | | | | | | | | | | | This fixes an error when compiling the kernel. CHK include/linux/version.h HOSTCC scripts/unifdef scripts/unifdef.c:209: error: conflicting types for 'getline' /usr/include/stdio.h:651: note: previous declaration of 'getline' was here make[1]: *** [scripts/unifdef] Error 1 make: *** [__headers] Error 2 Signed-off-by: Justin P. Mattock <justinmattock@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
* kbuild: replace use of strlcpy with a dedicated implmentation in unifdefSam Ravnborg2006-09-251-1/+8
| | | | Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
* kbuild: add unifdefSam Ravnborg2006-09-251-0/+998
This patch contains a raw copy of unifdef.c Next patch will modify it and add infrastructure to use it Adding unifdef to the kernel is acked by the author. The reason to add unifdef as part of the kernel source is that it is not yet a common utility on most distributions. Signed-off-by: Sam Ravnborg <sam@ravnborg.org>