nuttx/include/cxx/cstdlib
Gregory Nutt 67ec3d7926 Remove CONFIG_CAN_PASS_STRUCT
This commit resolves issue #620:

Remove CONFIG_CAN_PASS_STRUCTS #620

The configuration option CONFIG_CAN_PASS_STRUCTS was added many years ago to support an old version of the SDCC compiler. That compiler is currently used only with the Z80 and Z180 targets. The limitation of that old compiler was that it could not pass structures or unions as either inputs or outputs. For example:

    #ifdef CONFIG_CAN_PASS_STRUCTS
    struct mallinfo mallinfo(void);
    #else
    int      mallinfo(FAR struct mallinfo *info);
    #endif

And even leads to violation of a few POSIX interfaces like:

    #ifdef CONFIG_CAN_PASS_STRUCTS
    int  sigqueue(int pid, int signo, union sigval value);
    #else
    int  sigqueue(int pid, int signo, FAR void *sival_ptr);
    #endif

This breaks the 1st INVIOLABLES rule:

Strict POSIX compliance
-----------------------

  o Strict conformance to the portable standard OS interface as defined at
    OpenGroup.org.
  o A deeply embedded system requires some special support.  Special
    support must be minimized.
  o The portable interface must never be compromised only for the sake of
    expediency.
  o Expediency or even improved performance are not justifications for
   violation of the strict POSIX interface

Also, it appears that the current SDCC compilers have resolve this issue and so, perhaps, this is no longer a problem: z88dk/z88dk#1132

NOTE:  This commit cannot pass the PR checks because it depends on matching changes to the apps/ directory.
2020-04-11 21:19:47 +01:00

147 lines
3.0 KiB
Plaintext

//***************************************************************************
// include/cxx/cstdlib
//
// Licensed to the Apache Software Foundation (ASF) under one or more
// contributor license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright ownership. The
// ASF licenses this file to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance with the
// License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations
// under the License.
//
//***************************************************************************
#ifndef __INCLUDE_CXX_CSTDLIB
#define __INCLUDE_CXX_CSTDLIB
//***************************************************************************
// Included Files
//***************************************************************************
#include <nuttx/config.h>
#include <stdlib.h>
//***************************************************************************
// Namespace
//***************************************************************************
namespace std
{
// Random number generation
using ::srand;
using ::rand;
using ::random;
#ifndef CONFIG_DISABLE_ENVIRON
// Environment variable support
using ::get_environ_ptr;
using ::getenv;
using ::putenv;
using ::clearenv;
using ::setenv;
using ::unsetenv;
#endif
// Process exit functions
using ::exit;
using ::abort;
#ifdef CONFIG_SCHED_ATEXIT
using ::atexit;
#endif
#ifdef CONFIG_SCHED_ONEXIT
using ::on_exit;
#endif
#ifndef __KERNEL__
// System command
using ::system;
#endif
// String to binary conversions
using ::strtol;
using ::strtoul;
#ifdef CONFIG_HAVE_LONG_LONG
using ::strtoll;
using ::strtoull;
#endif
using ::strtof;
#ifdef CONFIG_HAVE_DOUBLE
using ::strtod;
#endif
#ifdef CONFIG_HAVE_LONG_DOUBLE
using ::strtold;
#endif
// Binary to string conversions
using ::itoa;
// Wide character operations
#ifdef CONFIG_LIBC_WCHAR
using ::mbtowc;
using ::wctomb;
#endif
// Memory Management
using ::malloc;
using ::free;
using ::realloc;
using ::memalign;
using ::zalloc;
using ::calloc;
using ::mallinfo;
#ifdef CONFIG_PSEUDOTERM
// Pseudo-Terminals
#ifdef CONFIG_PSEUDOTERM_SUSV1
using ::ptsname;
using ::ptsname_r;
#endif
using ::unlockpt;
#endif
// Arithmetic
using ::abs;
using ::labs;
#ifdef CONFIG_HAVE_LONG_LONG
using ::llabs;
#endif
using ::div;
using ::ldiv;
#ifdef CONFIG_HAVE_LONG_LONG
using ::lldiv;
#endif
// Temporary files
using ::mktemp;
using ::mkstemp;
// Sorting
using ::qsort;
// Binary search
using ::bsearch;
}
#endif // __INCLUDE_CXX_CSTDLIB