Changeset 10f924c for lib/libtrace.h.in


Ignore:
Timestamp:
05/23/14 17:31:26 (7 years ago)
Author:
Shane Alcock <salcock@…>
Branches:
4.0.1-hotfixes, cachetimestamps, develop, dpdk-ndag, etsilive, getfragoff, help, libtrace4, master, ndag_format, pfring, rc-4.0.1, rc-4.0.2, rc-4.0.3, rc-4.0.4, ringdecrementfix, ringperformance, ringtimestampfixes
Children:
2a7047c
Parents:
d3b6b91
Message:

Fixed broken -fvisibility check in configure

  • Added a m4 script that does this properly rather than our hax gcc version check.
  • Tidied up CFLAGS in configure so we aren't adding the same sets of flags multiple times
  • Created a wandio_internal.h file for storing global variables that shouldn't be made public

Thanks to Alistair King, whose patch to try and make this work for
non-gcc systems brought my attention to just how broken this was :)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/libtrace.h.in

    r74ecbc7 r10f924c  
    8080#if defined(LITTLE_ENDIAN) && !defined(__LITTLE_ENDIAN)
    8181#define __LITTLE_ENDIAN LITTLE_ENDIAN
    82 #endif
    83 
    84 #ifdef _MSC_VER
    85     /* define the following from MSVC's internal types */
    86     typedef             __int8  int8_t;
    87     typedef             __int16 int16_t;
    88     typedef             __int32 int32_t;
    89     typedef             __int64 int64_t;
    90     typedef unsigned    __int8  uint8_t;
    91     typedef unsigned    __int16 uint16_t;
    92     typedef unsigned    __int32 uint32_t;
    93     typedef unsigned    __int64 uint64_t;
    94     #ifdef LT_BUILDING_DLL
    95         #define DLLEXPORT __declspec(dllexport)
    96     #else
    97         #define DLLEXPORT __declspec(dllimport)
    98     #endif
    99     #define DLLLOCAL
    100     /* Windows pads bitfields out to to the size of their parent type
    101      * however gcc warns that this doesn't meet with the iso C specification
    102      * so produces warnings for this behaviour.  sigh.
    103      */
    104     #define LT_BITFIELD8        uint8_t
    105     #define LT_BITFIELD16       uint16_t
    106     #define LT_BITFIELD32       uint32_t
    107     #define LT_BITFIELD64       uint64_t
    108 #else
    109     #ifdef HAVE_STDINT_H
    110         #   include <stdint.h>
    111     #endif
    112     #if __GNUC__ >= 4
    113         #ifdef LT_BUILDING_DLL
    114                 #define DLLEXPORT __attribute__ ((visibility("default")))
    115                 #define DLLLOCAL __attribute__ ((visibility("hidden")))
    116         #else
    117                 #define DLLEXPORT
    118                 #define DLLLOCAL
    119         #endif
    120     #else
    121         #define DLLEXPORT
    122         #define DLLLOCAL
    123     #endif
    124     /* GCC warns if the bitfield type is not "unsigned int", however windows
    125      * generates incorrect code for this (see above), so we define these
    126      * macros.  How Hideous.  So much for C's portability.
    127      */
    128     #define LT_BITFIELD8        unsigned int
    129     #define LT_BITFIELD16       unsigned int
    130     #define LT_BITFIELD32       unsigned int
    131     #define LT_BITFIELD64       unsigned int
    13282#endif
    13383
     
    170120#endif
    171121
     122#ifdef _MSC_VER
     123    /* define the following from MSVC's internal types */
     124    typedef             __int8  int8_t;
     125    typedef             __int16 int16_t;
     126    typedef             __int32 int32_t;
     127    typedef             __int64 int64_t;
     128    typedef unsigned    __int8  uint8_t;
     129    typedef unsigned    __int16 uint16_t;
     130    typedef unsigned    __int32 uint32_t;
     131    typedef unsigned    __int64 uint64_t;
     132   
     133    /* Windows pads bitfields out to to the size of their parent type
     134     * however gcc warns that this doesn't meet with the iso C specification
     135     * so produces warnings for this behaviour.  sigh.
     136     */
     137    #define LT_BITFIELD8        uint8_t
     138    #define LT_BITFIELD16       uint16_t
     139    #define LT_BITFIELD32       uint32_t
     140    #define LT_BITFIELD64       uint64_t
     141#else
     142    #ifdef HAVE_STDINT_H
     143        #   include <stdint.h>
     144    #endif
     145    /* GCC warns if the bitfield type is not "unsigned int", however windows
     146     * generates incorrect code for this (see above), so we define these
     147     * macros.  How Hideous.  So much for C's portability.
     148     */
     149    #define LT_BITFIELD8        unsigned int
     150    #define LT_BITFIELD16       unsigned int
     151    #define LT_BITFIELD32       unsigned int
     152    #define LT_BITFIELD64       unsigned int
     153#endif
     154
    172155/* Function does not depend on anything but its
    173156 * parameters, used to hint gcc's optimisations
     157 *
     158 * TODO: Find a way to check for these that is not gcc-specific
    174159 */
    175160#if __GNUC__ >= 3
     
    186171#  define PRINTF(formatpos,argpos)
    187172#endif
     173
     174#ifdef _MSC_VER
     175    #ifdef LT_BUILDING_DLL
     176        #define DLLEXPORT __declspec(dllexport)
     177    #else
     178        #define DLLEXPORT __declspec(dllimport)
     179    #endif
     180    #define DLLLOCAL
     181#else
     182    #ifndef DLLEXPORT
     183        #if HAVE_VISIBILITY && LT_BUILDING_DLL
     184            #define DLLEXPORT __attribute__ ((visibility("default")))
     185            #define DLLLOCAL __attribute__ ((visibility("hidden")))
     186        #else
     187            #define DLLEXPORT
     188            #define DLLLOCAL
     189        #endif
     190    #endif
     191#endif
     192
    188193       
    189194/** Opaque structure holding information about an output trace */
Note: See TracChangeset for help on using the changeset viewer.