[asterisk-bugs] [JIRA] (ASTERISK-29581) compiler specific extension makes it impossible to compile asterisk on some platforms

Andrey (JIRA) noreply at issues.asterisk.org
Mon Aug 16 05:50:33 CDT 2021


Andrey created ASTERISK-29581:
---------------------------------

             Summary: compiler specific extension makes it impossible to compile asterisk on some platforms
                 Key: ASTERISK-29581
                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-29581
             Project: Asterisk
          Issue Type: Improvement
      Security Level: None
          Components: Core/BuildSystem
    Affects Versions: Feature Tracker
            Reporter: Andrey
            Severity: Blocker


I'm trying to compile Asterisk PBX on a platform that has proprietary gcc-compatible compiler without nested functions support. Also llvm/clang is not available for that platform.

I'm working on a source files preprocessing script that would unnest cleanup functions. But nevertheless it would require changes in original source files too.

I'd like to know if it would be possible to propose such a patch to the mainline?

General idea is to change the RAII_VAR macro as follows:
```
#define RAII_VAR(vartype, varname, initval, dtor)                              \
    vartype varname __attribute__((cleanup(_dtor_ ## varname))) = (initval)
```
and to create additional macro:
```
#define RAII_CLEANUP(vartype, varname, dtor)                              \
    void _dtor_ ## varname (vartype * v) { dtor(*v); }
```

After that, for each source file that contains  RAII_VAR-s generate separate file with RAII_CLEANUP-s for each variable, so, cleanup functions are now un-nested.

Finally, include that generated file into original one.

For example,
some_file.c:
```
#if defined(NO_RAII_SUPPORT)
#include "some.file.c.raii"
#endif

//... later
RAII_VAR(struct sendtext_data *, data, obj, ao2_cleanup);
```
and some_file.c.raii
```
RAII_CLEANUP(struct sendtext_data*, data, ao2_cleanup);
```

So, original source code modifications are minimal and consist of conditionally including a generated file.

Any thoughts are appreciated.
But, generally, I'd like to know if I'm on my own with this modifications or it is possible to include them in the main tree.



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list