Skip to content
  • Steven Rostedt (VMware)'s avatar
    locking/qspinlock: Fix build for anonymous union in older GCC compilers · 6cc65be4
    Steven Rostedt (VMware) authored
    One of my tests compiles the kernel with gcc 4.5.3, and I hit the
    following build error:
    
      include/linux/semaphore.h: In function 'sema_init':
      include/linux/semaphore.h:35:17: error: unknown field 'val' specified in initializer
      include/linux/semaphore.h:35:17: warning: missing braces around initializer
      include/linux/semaphore.h:35:17: warning: (near initialization for '(anonymous).raw_lock.<anonymous>.val')
    
    I bisected it down to:
    
     625e88be
    
     ("locking/qspinlock: Merge 'struct __qspinlock' into 'struct qspinlock'")
    
    ... which makes qspinlock have an anonymous union, which makes initializing it special
    for older compilers. By adding strategic brackets, it makes the build
    happy again.
    
    Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
    Acked-by: default avatarWaiman Long <longman@redhat.com>
    Cc: Andrew Morton <akpm@linux-foundation.org>
    Cc: Boqun Feng <boqun.feng@gmail.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Pe...
    6cc65be4