Openwall GNU/*/Linux - a small security-enhanced Linux distro for servers
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Sun, 19 May 2013 22:18:04 +0400
From: Alexander Cherepanov <>
Subject: Re: Unused macros

On 2013-05-18 18:02, wrote:
> dynamic_big_crypt.c:25: warning: unused macro 'WAS_MMX_OPENMP'
> dynamic_fmt.c:70: warning: unused macro 'WAS_MMX_OPENMP'
> is actually used later, in the include of dynamic_types.h Removal of
> these 2 would have caused OMP builds MMX to fail to link. In OMP is
> turned on on MMX builds (there is no thread safe MMX code). However,
> the MD5_std.c file has a different MD5_body (the thread safe one), so
> even though we are not using threads in dyna, we have to KNOW to use
> the threaded body function.
> So in other words, look carefully, and simply because something is
> defined in a .c file but never used later in it, does not mean it can
> our should be removed.  Probably pretty hard to eliminate these
> dangerous false positives using a simple script file.

It turned out that it's easy to get rid of such false positives if we 
tolerate some false negatives. The problem is in includes. And solution 
is to treat any macros as used if it's followed by include. Sure we will 
miss some unused macros with this approach but we'll get a clean list of 
issues without any false positives (at least I hope so). Right now full 
list for bleeding contains 478 items while safe list -- 393. When all 
safe issues are eliminated we can return to full list and review it one 
by one.

Attached are a safe version of the script and the list of safe issues 
for bleeding.

I also found that gcc (and clang) has an option -Wunused-macros. 
Somewhat suprisingly it doesn't make the script unnecessary as they find 
different things.

Alexander Cherepanov

View attachment "unused-macros" of type "text/plain" (1316 bytes)

View attachment "unused-macros.bleeding.txt" of type "text/plain" (20322 bytes)

Powered by blists - more mailing lists

Your e-mail address:

Powered by Openwall GNU/*/Linux - Powered by OpenVZ