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

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.

Activity

  1. brettcannon commented on Feb 24, 2017

    @brettcannon
    Member

    Won't removing ## break the macro, though, since e.g. tmpIn won't exist but instead simply be name? (And sorry about the late response; been on holiday.)

  2. tonybaloney commented on Nov 11, 2020

    @tonybaloney
    Contributor

    Implemented in #237

  3. oroppas commented on Nov 14, 2020

    @oroppas
    Author
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions