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

__STDC__ should be 1 (and not empty)

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P5: Not important
    • 6.0
    • 1.2.0
    • Shiboken

    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

        Activity

          People

            ctismer Christian Tismer
            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