lkml.org 
[lkml]   [2005]   [Jun]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC] cleanup patches for strings
cutaway@bellsouth.net wrote:
> There is a way to defeat the GCC string alignments by putting the strings in
> a dynamically sized structure if anyone cares. A bonus side effect of this
> scheme is that kernel/driver NLS translations would become almost trivial
> because all the string texts are collected in one place.
>
> The basic idea looks like this:
>
> #define MSG1 "Message text blah"
> #define MSG2 "Message text blah, blah"
> #define MSG3 "Message text blah, blah, blah"
>
> #ifndef __GCC_FORMAT_STRING_CHECKS__
> static const struct
> {
> char m1[sizeof(MSG1)+1];
> char m2[sizeof(MSG2)+1];
> char m3[sizeof(MSG3)+1];
> } msg = {
> {MSG1},
> {MSG2},
> {MSG3}
> };
> #undef MSG1
> #undef MSG2
> #undef MSG3
> #define MSG1 msg.m1
> #define MSG2 msg.m2
> #define MSG3 msg.m3
> #endif
>

Sometimes the cure is worse than the disease.

--
Brian Gerst
-
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: 2005-06-22 02:25    [W:0.043 / U:0.152 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site