lkml.org 
[lkml]   [2012]   [Jun]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v4 6/13] bug.h: Replace __linktime_error with __compiletime_error
On 06/25/2012 01:16 PM, Paul Gortmaker wrote:
>
> At a quick glance of the bug.h parts, I would think you need
> this commit _before_ #5 (that deleted __linktime_error) otherwise
> you'll have introduced a bisection build failure. Or, alternatively
> you could combine #5 and #6 since they are clearly related, and
> their separation is more of a per-file CVS mentality than it is of
> any existence of distinct and separate/unrelated changesets.
>
> P.
Thanks, will do.

And after I thought about this more, I realized that both
__build_bug_failed and __build_bug_on_failed could just be declared
globally rather than being part of the macro. It may not be that big of
a deal, but it would reduce the size of pre-processed files at least
(something I look at a lot working with this patch set). But I'll let
you make the final call on that one

Oh, and as it turns out, adding the string-ized condition in the
BUILD_BUG_ON macro is useless (actually confusing) since gcc takes the
attributes of the first occurrence of an externed function in a
translation unit. Thus, the following code:

#include <linux/bug.h>
void func(void)
{
const int a = 0;
BUILD_BUG_ON(a == 1);
BUILD_BUG_ON(1) ;
}

would result in the error message:

call to ‘__build_bug_on_failed’ declared with attribute error:
BUILD_BUG_ON failed: a == 1

At least the line number is correct however. So my "declare a function
multiple times with with differing attributes" turns out to not work right.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2012-06-25 22:21    [W:0.103 / U:51.540 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site