[compiler-rt] r177578 - Create a coverage initialization function.

Alexander Zinenko ftynse at gmail.com
Wed Mar 20 16:34:34 PDT 2013


Thanks, build passes after r177601.


On 21 March 2013 01:19, Bill Wendling <isanbard at gmail.com> wrote:

> The error is wrong. I added that declaration to the proper header file. :-(
>
> -bw
>
> On Mar 20, 2013, at 4:11 PM, Alexander Zinenko <ftynse at gmail.com> wrote:
>
> > Hello, Bill!
> >
> > I'm sorry, but this commit seems having break clang-x86_64-debian-fast
>  buildbot.
> > (http://lab.llvm.org:8011/builders/clang-x86_64-debian-fast/builds/2934)
> >
> /home/llvmbb/llvm-build-dir/clang-x86_64-debian-fast/llvm.src/projects/compiler-rt/lib/profile/GCDAProfiling.c:398:5:
> error: implicit declaration of function 'atexit' is invalid in C99
> [-Werror,-Wimplicit-function-declaration]
> >     atexit(llvm_delete_flush_function_list);
> >
> >
> > On 20 March 2013 23:11, Bill Wendling <isanbard at gmail.com> wrote:
> > Author: void
> > Date: Wed Mar 20 16:11:47 2013
> > New Revision: 177578
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=177578&view=rev
> > Log:
> > Create a coverage initialization function.
> >
> > This function replaces the call of `atexit' from being generated in the
> compile
> > units. Basically, it registers the "writeout" and "flush" functions (if
> > present). It will generate calls to the `atexit' function for cleanups
> and final
> > writeout functions, but only once. This is better than checking for
> `main',
> > because a library may not have a `main' function in it.
> > <rdar://problem/12439551>
> >
> > Modified:
> >     compiler-rt/trunk/SDKs/darwin/usr/include/stdlib.h
> >     compiler-rt/trunk/lib/profile/GCDAProfiling.c
> >
> > Modified: compiler-rt/trunk/SDKs/darwin/usr/include/stdlib.h
> > URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/SDKs/darwin/usr/include/stdlib.h?rev=177578&r1=177577&r2=177578&view=diff
> >
> ==============================================================================
> > --- compiler-rt/trunk/SDKs/darwin/usr/include/stdlib.h (original)
> > +++ compiler-rt/trunk/SDKs/darwin/usr/include/stdlib.h Wed Mar 20
> 16:11:47 2013
> > @@ -22,6 +22,7 @@
> >  typedef __SIZE_TYPE__ size_t;
> >
> >  void abort(void) __attribute__((__noreturn__));
> > +int atexit(void (*)(void));
> >  int atoi(const char *);
> >  void free(void *);
> >  char *getenv(const char *);
> >
> > Modified: compiler-rt/trunk/lib/profile/GCDAProfiling.c
> > URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/profile/GCDAProfiling.c?rev=177578&r1=177577&r2=177578&view=diff
> >
> ==============================================================================
> > --- compiler-rt/trunk/lib/profile/GCDAProfiling.c (original)
> > +++ compiler-rt/trunk/lib/profile/GCDAProfiling.c Wed Mar 20 16:11:47
> 2013
> > @@ -331,7 +331,7 @@ void llvm_register_writeout_function(wri
> >    }
> >  }
> >
> > -void __llvm_writeout_files() {
> > +void llvm_writeout_files() {
> >    struct writeout_fn_node *curr = writeout_fn_head;
> >
> >    while (curr) {
> > @@ -381,3 +381,22 @@ void llvm_delete_flush_function_list() {
> >
> >    flush_fn_head = flush_fn_tail = NULL;
> >  }
> > +
> > +void llvm_gcov_init(writeout_fn wfn, flush_fn ffn) {
> > +  static int atexit_ran = 0;
> > +
> > +  if (wfn)
> > +    llvm_register_writeout_function(wfn);
> > +
> > +  if (ffn)
> > +    llvm_register_flush_function(ffn);
> > +
> > +  if (atexit_ran == 0) {
> > +    atexit_ran = 1;
> > +
> > +    /* Make sure we write out the data and delete the data structures.
> */
> > +    atexit(llvm_delete_flush_function_list);
> > +    atexit(llvm_delete_writeout_function_list);
> > +    atexit(llvm_writeout_files);
> > +  }
> > +}
> >
> >
> > _______________________________________________
> > llvm-commits mailing list
> > llvm-commits at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130321/0f13b39a/attachment.html>


More information about the llvm-commits mailing list