• Al Viro's avatar
    fix __swap_writepage() compile failure on old gcc versions · 05064084
    Al Viro authored
    Tetsuo Handa wrote:
     "Commit 62a8067a ("bio_vec-backed iov_iter") introduced an unnamed
      union inside a struct which gcc-4.4.7 cannot handle.  Name the unnamed
       union as u in order to fix build failure"
    
    Let's do this instead: there is only one place in the entire tree that
    steps into this breakage.  Anon structs and unions work in older gcc
    versions; as the matter of fact, we have those in the tree - see e.g.
    struct ieee80211_tx_info in include/net/mac80211.h
    
    What doesn't work is handling their initializers:
    
    struct {
    	int a;
    	union {
    		int b;
    		char c;
    	};
    } x[2] = {{.a = 1, .c = 'a'}, {.a = 0, .b = 1}};
    
    is the obvious syntax for initializer, perfectly fine for C11 and
    handled correctly by gcc-4.7 or later.
    
    Earlier versions, though, break on it - declaration is fine and so's
    access to fields (i.e.  x[0].c = 'a'; would produce the right code), but
    members of the anon structs and unions are not inserted into the right
    namespace.  Telling...
    05064084
page_io.c 9.53 KB