IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 40551


Ignore:
Timestamp:
Oct 20, 2018, 9:08:56 PM (8 years ago)
Author:
eugene
Message:

add ps_snprintf_nowarn function to avoid compiler optimization warnings triggered by overly-script gcc checking since 8.1

Location:
trunk/psLib/src/sys
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/sys/psString.c

    r31152 r40551  
    496496}
    497497
     498// several snprintf statements below my truncate their output
     499// gcc (since 8.1) warns if the output may be truncated.
     500// the following NOOP function is used to fool the compiler
     501// see ps_snprintf_nowarn in psString.h
     502void psNOOP (void) { }
  • trunk/psLib/src/sys/psString.h

    r31152 r40551  
    4040#define PS_FILE_LINE p_psFileLine(__FILE__,__LINE__)
    4141
     42// gcc (since 8.1) warns if the output may be truncated by snprint.
     43// since that is sometimes a desired behavior, this version of snprintf
     44// is defined to fool the compiler about this warning:
     45// the following NOOP function is used to fool the compiler
     46// see snprintf_nowarn in ohana.h
     47#define ps_snprintf_nowarn(...) (snprintf(__VA_ARGS__) < 0 ? psNOOP() : 0)
     48void psNOOP (void);
     49
     50// some constants to use in snprintf statements and variable definitions to ensure
     51// consistency
     52# define PS_SMALLWORD 16
     53# define PS_BIGWORD 128
     54
    4255/** Allocates a new psString.
    4356 *
Note: See TracChangeset for help on using the changeset viewer.