Uploaded image for project: 'SonarCFamily'
  1. SonarCFamily
  2. CPP-154

Rule : Avoid use of obsolete POSIX functions (CPP rules migration)

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.2
    • Component/s: Cppcheck, Rules
    • Labels:
      None

      Description

      • Title
        Avoid use of obsolete POSIX functions
      • Description
        To prevent any portability issue the calls to obsolete POSIX functions should be removed.
      • Violation message
        Remove use of this obsolete 'xxxxx' function. Replace it by a call to 'yyyyy'

      This check must be done on the following list of obsolet functions :
      asctime -> strftime
      asctime_r -> strftime
      bcmp -> memcmp
      bcopy -> memmove memcpy
      bsd_signal -> sigaction
      bzero -> memset
      ctime -> strftime
      ecvt -> sprintf
      fcvt -> sprintf
      ftime -> no replacement function
      gcvt -> sprintf
      getcontext -> Due to portability issues with this function, applications are recommended to be rewritten to use POSIX threads
      gethostbyaddr -> getnameinfo
      gethostbyname -> getaddrinfo
      getwd -> getcwd
      index -> strchr
      makecontext -> Due to portability issues with this function, applications are recommended to be rewritten to use POSIX threads
      pthread_attr_getstackaddr -> pthread_attr_getstack
      pthread_attr_setstackaddr -> pthread_attr_setstack
      rand_r -> rand
      rindex -> strrchr
      scalb -> scalbln', 'scalblnf' or 'scalblnl' instead of this function
      swapcontext -> Due to portability issues with this function, applications are recommended to be rewritten to use POSIX threads
      tmpnam -> 'tmpfile', 'mkstemp', or 'mkdtemp' instead for this function
      tmpnam_r -> tmpfile', 'mkstemp', or 'mkdtemp' instead for this function
      ualarm -> 'timer_create', 'timer_delete', 'timer_getoverrun', 'timer_gettime', or 'timer_settime' instead of this function
      usleep -> 'nanosleep' or 'setitimer' function
      utime -> utimensat
      vfork -> fork
      wcswcs -> wcsstr

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                julien.henry Julien Henry
                Reporter:
                freddy.mallet Freddy Mallet (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: