Uploaded image for project: 'Qt for Python'
  1. Qt for Python
  2. PYSIDE-206

__STDC__ should be 1 (and not empty)

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P5: Not important
    • Resolution: Done
    • Affects Version/s: 1.2.0, dev
    • Fix Version/s: dev
    • Component/s: Shiboken
    • Labels:

      Description

      In http://qt-project.org/forums/viewthread/34477/ I describe the symptoms. Mysteriously, const disappears from some declarations and compilation of C++ code fails.

      After searching for a long time, it turns out that the pre-defined preprocessor macro __STDC__ is defined but empty. According to K&R, it should be defined as "1".

      The result is that when in the shiboken test cases some system headers are pulled in, it gets to preprocess a line like

      #if __STDC__ || defined(__cplusplus)                                            
      

      which after macro expansion looks like

      #if  || defined(__cplusplus)     
      

      which evaluates as false (due to syntax error). As a result, a pre-ANSI C compiler is assumed and "const" and a few more keywords are #defined away.

      The fix is simple. See attached file.

      Aside: I suspect that the code which suppresses macro expansion following the word "defined" is always active, and not just in preprocessor directives. That would be another bug, which I have not checked.

      Aside 2: this affects at least the released version 1.2.1 but the bug tracker doesn't know about that version.

        Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            ctismer Christian Tismer
            Reporter:
            rhialto Olaf Seibert
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 30 minutes
                30m

                  Gerrit Reviews

                  There are no open Gerrit changes