This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

libgomp platform customization


Hello,

we would like to use libgomp in a quite constraint environment. In this environment using for example the C locale support, errno, malloc(), realloc(), free(), and abort() are problematic. One option would be to introduce a new header file "config/*/platform.h" which is included in libgomp.h right after the #include "config.h". A platform could then do something like this:

#define malloc(size) platform_malloc(size)
...

In env.c there are some uses of strto*() like this:

  errno = 0;
  stride = strtol (env, &env, 10);
  if (errno)
    return false;

I would like to introduce a new header file "strto.h" which defines something like this:

static inline char *
gomp_strtol (char *s, long *value)
{
  char *end;

  errno = 0;
  *value = strtol (s, &end, 10);
  if (errno != 0)
    return NULL;

  return end;
}

Then use:

  env = gomp_strtol (env, &stride);
  if (env == NULL)
    return false;

A platform could then provide its own "config/*/strto.h" with an alternative implementation.

Would this be acceptable after the GCC 9 release?

--
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber@embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]