jed-users mailing list

[2018 Date Index] [2018 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

[jed-users] OT: Need an expanded compilation listing


All,

This is completely off-topic, but the chat group has gone completely silent after I asked my question, but, a JED user just might have a full build environment already setup and can generate what I need.

I'm in the process of porting logger.c to OpenVMS. The available C compiler only goes up to the C99 standard (and possibly not all of it). Most of the source files came from here <https://github.com/karelzak/util-linux> if that makes a difference. Some headers had to be pulled from gcc itself <https://github.com/gcc-mirror/gcc>.

Naturally there is a lot of bad code and someone decided to prove just how creative they could be with macros. Never good. Currently list.h has a set of #defines I haven't been able to unwind to the compiler's satisfaction.

/**
 * list_entry - get the struct for this entry
 * @ptr:    the &struct list_head pointer.
 * @type:   the type of the struct this is embedded in.
 * @member: the name of the list_struct within the struct.
 */
#define list_entry(ptr, type, member) __extension__ ({              \
    const typeof( ((type *)0)->member ) *__mptr = (ptr);   \
    (type *)( (char *)__mptr - offsetof(type,member) );})


#define list_first_entry(head, type, member) \
    ((head) && (head)->next != (head) ? list_entry((head)->next, type, member) : NULL)

#define list_last_entry(head, type, member) \
    ((head) && (head)->prev != (head) ? list_entry((head)->prev, type, member) : NULL)

The list_entry macro gets used in logger.c too. I managed to get rid of all the other macros which used __extension__ and returned a value inside of (). Not cool btw.

What I need, if someone already has a build environment setup and a logger.c which is close enough is a compilation listing for logger. According to this link <https://gcc.gnu.org/onlinedocs/gcc/Preprocessor-Options.html>the gcc switches should be -dD -dI

That "should" get all macro expansions and the include files in the output. Then I can mechanically replace things and continue onward.

Sorry for the off-topic post, but the developer chat room for the link had people scattering when I asked the question.

Roland


--
Roland Hughes, President
Logikal Solutions
(630)-205-1593

http://www.theminimumyouneedtoknow.com
http://www.infiniteexposure.net
http://www.johnsmith-book.com
http://www.logikalblog.com
http://www.interestingauthors.com/blog
http://lesedi.us/
http://onedollarcontentstore.com


[2018 date index] [2018 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]