Skip to content
  • Brad King's avatar
    Allow multiple modules to auto-init a given module · e6aba7c2
    Brad King authored
    The prior auto-init implementation injected a definition of
    
      struct <mod>_AutoInit
    
    into application translation units.  If the same <mod> appeared in more
    than one auto-init list then the definition would be repeated and fail
    to compile.  Since macro expansion cannot implement an equivalent to
    include blockers we need an alternative.  Instead use functions
    
      <mod>_AutoInit_Construct
      <mod>_AutoInit_Destruct
    
    to hook into module static initialization and finalization.  Function
    declarations can be repeated.  Inject into an application translation
    unit at most one static data instance per module.  Generate its
    constructor and destructor to call the above functions for every module
    in the auto-init list.
    
    Change-Id: I202d74f8ba0a457a7688c0d22f68aacbcdc47617
    e6aba7c2