Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.
This repository was archived by the owner on Oct 12, 2022. It is now read-only.

Macro preprocessing error from g++ and clang++ #211

@oroppas

Description

@oroppas

g++ (6.3.1) and clang++ (3.9.1), I've got

/home/ryuta/packages/pyjion/src/pyjion-git/Pyjion/taggedptr.h:60:10: error: pasting "*" and "tmpIn" does not give a valid preprocessing token
  PyObject* ##name = init_number(tmp_##name, value);
          ^
/home/ryuta/packages/pyjion/src/pyjion-git/Pyjion/intrins.cpp:2445:9: note: in expansion of macro ‘INIT_TMP_NUMBER’
         INIT_TMP_NUMBER(tmpIn, UNTAG_IT(inI));
         ^~~~~~~~~~~~~~~
        size_t tmp_tmpIn[(((sizeof(PyVarObject) + sizeof(uint32_t) * ((((sizeof(tagged_ptr) * 8) - 1) + 30 - 1) / 30)) / sizeof(size_t)) + sizeof(size_t))]; PyObject*tmpIn = init_number(tmp_tmpIn, ((inI) >> 1));;
        *out = PyLong_AsDouble(tmpIn);
    }
    else {
        *out = PyLong_AsDouble(in);
    }
    return *out == -1.0 && PyErr_Occurred();
}

PyObject* ##name = init_number(tmp_##name, value);

get preprocessed to

PyObject*tmpIn = init_number(tmp_tmpIn, ((inI) >> 1))

## of ##name in PyObject* ##name = init_number(tmp_##name, value); should be removed.
Is this change valid? I don't have a Windows machine to check this change won't break the build.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions