GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> PBI / V0-1-2 > test_attribute / mv2304


Interface   Data Structures   File List   Data Fields   Globals  

test_attribute.c File Reference

Unit test of the macros in PBI/Attribute.h. More...

#include <stdio.h>
#include <PBI/Attribute.h>

Defines

#define YES_OR_NO   "NO"
 Symbol defined to be the string YES or NO depending on wheter the attribute directive is supported.
#define TEST_MISSION
 Symbol representing the string stating the mission of this test. It is purely here to make the code read nicer.

Functions

int main (int argc, char *const argv[])
 Standard main entry point for Unix platforms. It merely calls the testing routine test_attributes ().
int test_attribute (void)
 The test program itself and also the entry point for running this test on VxWork's platforms.
static void unused (void)
 As the name suggests, the unused function used to test the compiler's response to unused static functions.


Detailed Description

Unit test of the macros in PBI/Attribute.h.

Author:
JJRussell - russell@slac.stanford.edu
   CVS $Id: test_attribute.c,v 1.5 2011/03/24 20:50:58 apw Exp $

This tests whether the compiler supports the __attribute__ directive and, if not, whether PBI/Attribute.h correctly #define's it away.

It directly tests the compiler's warnings on unused static routines. If this code compiled cleanly, then the attribute feature either is supported and works correctly or the attribute feature is not supported, but the compiler does not issue warning message for unused statics.

This is currently the state of affairs with the gcc compiler and the SUN cc compiler. The gcc compiler supports this feature, so no error messages are issued. The SUN cc compiler does not support this feature, but, in turn, does not issue warning messages for unused static routines."

To run the program type


   On Unix platforms:
   $ test_attribute

   On VxWorks
   > test_attribute ()

 

The program returns 0 if successful, else -1.


Define Documentation

#define TEST_MISSION

Value:

"\n"                                                     \
"\n"                                                                          \
" Testing of the Compiler Attributes Directive\n"                             \
" --------------------------------------------\n"                             \
" This tests whether the compiler supports the __attribute__ directive and,\n"\
" if not, whether PBI/Attribute.h correctly #define's it away.\n"             \
"\n"                                                                          \
" It directly tests the compiler's warnings on unused static routines. If\n"  \
" this code compiled cleanly, then the attribute feature either is\n"         \
" supported and works correctly or the attribute feature is not supported,\n" \
" but the compiler does not issue warning message for unused statics.\n"      \
"\n"                                                                          \
" This is currently the state of affairs with the gcc compiler and the SUN\n" \
" cc compiler. The gcc compiler supports this feature, so no error messages\n"\
" are issued. The SUN cc compiler does not support this feature, but, in\n"   \
" turn, does not issue warning messages for unused static routines.\n"
Symbol representing the string stating the mission of this test. It is purely here to make the code read nicer.

Referenced by test_attribute().


Function Documentation

int main ( int  argc,
char *const   argv[] 
)

Standard main entry point for Unix platforms. It merely calls the testing routine test_attributes ().

Return values:
0,if successful
-1,if unsuccessful
This program takes no arguments.

References test_attribute().

int test_attribute ( void   ) 

The test program itself and also the entry point for running this test on VxWork's platforms.

Return values:
0,if successful
-1,if unsucceful

References TEST_MISSION, and YES_OR_NO.

Referenced by main().


Generated on Fri Apr 1 17:23:38 2011 by  doxygen 1.5.8