[lkml]   [2005]   [Oct]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: 2.6.14 assorted warnings
    On Sun, Oct 30, 2005 at 10:15:31PM +0000, Alan Cox wrote:
    > gcc is a *LOT* smarter than you give it credit for. It will not warn for
    > cases where it isn't able to tell how foo is used passed with &foo. It
    > will warn for cases where it can

    static inline __attribute__((always_inline)) int bar(int n, int *idx)
    if (n != 1)
    return 0;
    *idx = 1;
    return 1;
    void baz(int *v, int n)
    int idx;
    int p = bar(n, &idx);
    if (__builtin_expect(!p, 0))
    *v |= idx;

    and try gcc -Wall on that. Watch it warn about idx being possibly
    uninitialized. Replace __builtin_expect(!p, 0) with !p and see
    the warning go away. That, BTW, is a trimmed-down source of bogus
    warning in bio.c. And a lot of its analogs all over the tree.
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to
    More majordomo info at
    Please read the FAQ at

     \ /
      Last update: 2005-10-30 23:28    [W:0.020 / U:13.288 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site