#93 reserved identifier violation

future
open-accepted
nobody
None
5
2012-12-15
2008-02-15
Markus Elfring
No

Your software can not be treated as a compiler. Names that start with an underscore and an uppercase letter like "_SIPP_SEND_PACKETS_H_" and "__MESSAGE__" should be avoided. Parts of your source files do not fit to the expected naming conventions of the C language standard.
http://www.open-std.org/JTC1/SC22/WG14/www/docs/n1124.pdf
http://en.wikipedia.org/wiki/Reserved_identifier

Discussion

  • Rob Day
    Rob Day
    2012-12-12

    Hi Markus,

    I can't find any examples of the identifiers you mention in the current SIPp code (see below). I'm therefore going to close this bug report, but if I've missed something, please feel free to raise a new bug with more specific details of the problem.

    Best,
    Rob

    rob@rivertam:~/Programming/Cpp/sipp/sipp/trunk$ egrep " _[A-Z]" *.cpp *.c
    call.cpp:#ifdef _USE_OPENSSL
    call.cpp:#ifdef _USE_OPENSSL
    call.cpp:#ifdef _USE_OPENSSL
    call.cpp: _RCAST(struct sockaddr_storage *,local_addr_storage->ai_addr)));
    call.cpp: _RCAST(struct sockaddr_storage *,h->ai_addr)));
    call.cpp:#ifndef _USE_OPENSSL
    call.cpp:#ifdef _USE_OPENSSL
    call.cpp:#ifdef _USE_OPENSSL
    message.cpp:#ifndef _USE_OPENSSL
    scenario.cpp:#ifdef _USE_OPENSSL
    scenario.cpp:#ifdef _USE_OPENSSL
    scenario.cpp:#ifdef _USE_OPENSSL
    sipp.cpp:#ifdef _USE_OPENSSL
    sipp.cpp:#ifdef _USE_OPENSSL
    sipp.cpp:#ifdef _USE_OPENSSL
    sipp.cpp:#ifdef _USE_OPENSSL
    sipp.cpp:#ifdef _USE_OPENSSL
    sipp.cpp:#ifdef _USE_OPENSSL
    sipp.cpp:#ifdef _USE_OPENSSL
    sipp.cpp:#ifdef _USE_OPENSSL
    sipp.cpp:#ifdef _USE_OPENSSL
    sipp.cpp:#ifdef _USE_OPENSSL
    sipp.cpp:#ifndef _USE_OPENSSL
    sipp.cpp:#ifdef _USE_OPENSSL
    sipp.cpp:#ifdef _USE_OPENSSL
    sipp.cpp:#ifdef _USE_OPENSSL
    sipp.cpp:#ifdef _UNITTEST
    sipp.cpp:#ifdef _USE_OPENSSL
    sipp.cpp:#ifdef _USE_OPENSSL
    sipp.cpp:#ifdef _USE_OPENSSL
    sipp.cpp: _RCAST(struct sockaddr_storage *,local_addr->ai_addr)));
    sipp.cpp: _RCAST(struct sockaddr_storage *,local_addr->ai_addr)));
    sipp.cpp: _RCAST(struct sockaddr_storage *, local_addr->ai_addr)));
    sipp.cpp: _RCAST(struct sockaddr_storage *,local_addr->ai_addr)));
    sipp.cpp: _RCAST(struct sockaddr_storage *, local_addr->ai_addr)));
    sipp.cpp: _RCAST(struct sockaddr_storage *, local_addr->ai_addr)));
    sipp.cpp: _RCAST(struct sockaddr_storage *, local_addr->ai_addr)));
    sipp.cpp: _RCAST(struct sockaddr_storage *,local_addr->ai_addr)));
    sipp.cpp: _RCAST(struct sockaddr_storage *,local_addr->ai_addr)));
    send_packets.c:#define _BSD_SOURCE
    send_packets.c:#ifndef _HPUX_LI
    sslthreadsafe.c:#ifdef _DYNAMIC_LOCKING_MECHANISM_
    sslthreadsafe.c:#ifdef _DYNAMIC_LOCKING_MECHANISM_
    sslthreadsafe.c:#ifdef _DYNAMIC_LOCKING_MECHANISM_

     
  • Rob Day
    Rob Day
    2012-12-12

    • status: open --> closed-rejected
     
  • Rob Day
    Rob Day
    2012-12-12

    • status: closed-rejected --> open-accepted
     
  • Rob Day
    Rob Day
    2012-12-12

    Markus responded by email with a link to https://www.securecoding.cert.org/confluence/display/seccode/DCL37-C.+Do+not+declare+or+define+a+reserved+identifier#DCL37-CDonotdeclareordefineareservedidentifier-NoncompliantCodeExampleHeaderGuard, which characterises the problem more clearly, so I've accepted this bug.

    It looks as though the offenders are the following #defines, and the solution is simply to replace these identifiers, everywhere they appear in the code, with versions which neither begin with an underscore nor contain two consecutive underscores.

    $ egrep "define (_[A-Z]|.*__.*)" *.{hpp,h}
    actions.hpp:#define _CACTIONS
    call.hpp:#define __CALL__
    infile.hpp:#define __FILECONTENTS__
    listener.hpp:#define __LISTENER__
    message.hpp:#define __MESSAGE__
    scenario.hpp:#define __SCENARIO__
    screen.hpp:#define __SCREEN_H__
    sipp.hpp:#define __SIPP__
    sipp.hpp:#define _DEFVAL(value) = value
    sipp.hpp:#define _DEFVAL(value)
    sipp.hpp:#define _RCAST(type, val) (reinterpret_cast<type> (val))
    sipp.hpp:#define _RCAST(type, val) ((type)(val))
    socketowner.hpp:#define __SOCKETOWNER__
    stat.hpp:#define __STAT_H__
    task.hpp:#define __TASK__
    variables.hpp:#define _CVARIABLE
    send_packets.h:#define _SIPP_SEND_PACKETS_H_

     
  • Rob Day
    Rob Day
    2012-12-15

    • milestone: v1.0 --> future