This is the mail archive of the ecos-bugs@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug 1000111] New: diag_printf should use GCC function attributes where available


http://bugs.ecos.sourceware.org/show_bug.cgi?id=1000111

           Summary: diag_printf should use GCC function attributes where
                    available
           Product: eCos
           Version: CVS
          Platform: Other
        OS/Version: All
            Status: UNCONFIRMED
          Severity: normal
          Priority: low
         Component: Debugging
        AssignedTo: gary@mlbassoc.com
        ReportedBy: tom.lynn@hypertag.com
         QAContact: ecos-bugs@sources.redhat.com


eCos isn't taking advantage of the built-in lint functions of recent gcc
versions for printf-style functions.  Since this kind of thing can be
particularly hard to track down on embedded systems, this is a shame.
See http://gcc.gnu.org/onlinedocs/gcc-3.3.1/gcc/Function-Attributes.html

Example code to implement this (/ecos/packages/infra/current/include/diag.h:95):

// TODO: I don't know how GCC stores its version info, or what version this 
//       was introduced in...
//
#ifdef __GNUC__
# undef  GCC_FUNC_ATTRIB
# define GCC_FUNC_ATTRIB(X)  __attribute__(X)
#else
# undef  GCC_FUNC_ATTRIB
# define GCC_FUNC_ATTRIB(X) 
#endif

externC int  diag_printf( const char *fmt, ... ) GCC_FUNC_ATTRIB((format
(printf, 1, 2)));
    
externC void diag_init_putc(void (*putc)(char c, void **param));
externC int  diag_sprintf(char *buf, const char *fmt, ...)             
GCC_FUNC_ATTRIB((format (printf, 2, 3)));
externC int  diag_snprintf(char *buf, size_t len, const char *fmt, ...)
GCC_FUNC_ATTRIB((format (printf, 3, 4)));
externC int  diag_vsprintf(char *buf, const char *fmt, va_list ap)     
GCC_FUNC_ATTRIB((format (printf, 2, 0)));
externC int  diag_vprintf(const char *fmt, va_list ap)                 
GCC_FUNC_ATTRIB((format (printf, 1, 0)));



------- You are receiving this mail because: -------
You are the QA contact for the bug, or are watching the QA contact.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]