Changeset e464759 for src


Ignore:
Timestamp:
Apr 27, 2017, 1:54:41 PM (7 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
0c78741
Parents:
075d862
Message:

Abortf is not a proper C linkage function

Location:
src/libcfa
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/libcfa/interpose.c

    r075d862 re464759  
    2626
    2727#include "libhdr/libdebug.h"
     28#include "libhdr/libtools.h"
    2829#include "startup.h"
    29 
    30 void abortf( const char *fmt, ... ) __attribute__ ((__nothrow__, __leaf__, __noreturn__));
    3130
    3231void interpose_startup(void)  __attribute__(( constructor( STARTUP_PRIORITY_CORE ) ));
     
    115114static char abort_text[ abort_text_size ];
    116115
    117 void abortf( const char fmt[], ... ) __attribute__ ((__nothrow__, __leaf__, __noreturn__)) {
    118         void * kernel_data = kernel_abort();
    119        
    120         int len;
    121        
    122         if( fmt ) {
    123                 va_list args;
    124                 va_start( args, fmt );
     116extern "C" {
     117        void abortf( const char fmt[], ... ) __attribute__ ((__nothrow__, __leaf__, __noreturn__)) {
     118                void * kernel_data = kernel_abort();
    125119
    126                 len = vsnprintf( abort_text, abort_text_size, fmt, args );
     120                int len;
    127121
    128                 va_end( args );
     122                if( fmt ) {
     123                        va_list args;
     124                        va_start( args, fmt );
    129125
     126                        len = vsnprintf( abort_text, abort_text_size, fmt, args );
     127
     128                        va_end( args );
     129
     130                        __lib_debug_write( STDERR_FILENO, abort_text, len );
     131                        __lib_debug_write( STDERR_FILENO, "\n", 1 );
     132                }
     133
     134                len = snprintf( abort_text, abort_text_size, "Cforall Runtime error (UNIX pid:%ld)\n", (long int)getpid() ); // use UNIX pid (versus getPid)
    130135                __lib_debug_write( STDERR_FILENO, abort_text, len );
    131                 __lib_debug_write( STDERR_FILENO, "\n", 1 );
    132         }
    133 
    134         len = snprintf( abort_text, abort_text_size, "Cforall Runtime error (UNIX pid:%ld)\n", (long int)getpid() ); // use UNIX pid (versus getPid)
    135         __lib_debug_write( STDERR_FILENO, abort_text, len );
    136136
    137137
    138         kernel_abort_msg( kernel_data, abort_text, abort_text_size );
     138                kernel_abort_msg( kernel_data, abort_text, abort_text_size );
    139139
    140         libc_abort();
     140                libc_abort();
     141        }
    141142}
  • src/libcfa/libhdr/libtools.h

    r075d862 re464759  
    2222// } // libAbort
    2323
    24 #define abortf(...) abort();
    25 
     24#ifdef __cforall
     25extern "C" {
     26#endif
     27void abortf( const char fmt[], ... ) __attribute__ ((__nothrow__, __leaf__, __noreturn__));
     28#ifdef __cforall
     29}
     30#endif
    2631
    2732#endif //__LIB_TOOLS_H__
Note: See TracChangeset for help on using the changeset viewer.