Menu

Why syntaxError 53?

2016-07-06
2016-07-14
  • Sander Bouwhuis

    Sander Bouwhuis - 2016-07-06

    Why do I get a syntaxError on line 53? That is the line with :

    enum TASKBAR_POS
    

    This is the source code:

    //
    // Miscellaneous.h : Header file for Miscellaneous.cpp
    //
    //
    
    // Only include this header file once
    #pragma once
    
    #include "_Export.h"
    
    // Check whether to export this class or not
    #ifdef MISCELLANEOUS
      #ifdef CLASSES_DLL
        #define MISCELLANEOUS_EXP __declspec(dllexport)
      #else
        #define MISCELLANEOUS_EXP __declspec(dllimport)
      #endif
    #else
      #define MISCELLANEOUS_EXP
    #endif
    
    // forward declarations
    class CDataCube;
    class CDate;
    class CPicture;
    class CTime;
    
    // A MAC address
    struct MAC_ADDRESS
    {
      uint8 pu8MacAddress[6];
    };
    
    // The display monitor dimensions
    struct DISPLAY_MONITOR_DIMENSIONS
    {
      uint8 u8TotRects;
      RECT  pRect[64];
    
      DISPLAY_MONITOR_DIMENSIONS()
      {
        // Clear the variables
        u8TotRects = 0;
        memset(pRect, NULL, sizeof(pRect));
      }
    };
    
    // The taskbar position
    enum TASKBAR_POS
    {
      left,   // The taskbar is on the left side of the screen
      top,    // The taskbar is on the top side of the screen
      right,  // The taskbar is on the right side of the screen
      bottom  // The taskbar is on the bottom side of the screen
    };
    
    // Function prototypes
    MISCELLANEOUS_EXP void        AppendTextToEditBox(HWND hWndEditbox, const wchar_t *pwcNewText, int32 i32Len = -1);
    MISCELLANEOUS_EXP bool        CheckMemProblem(int8 *pi8Mem, int32 i32Bytes);
    MISCELLANEOUS_EXP void        ClipRect(RECT *pRc, const RECT *pRcClip);
    MISCELLANEOUS_EXP bool        CopyDataToClipboard(const void *pvData, int32 i32Len, uint32 u32Format = CF_UNICODETEXT);
    MISCELLANEOUS_EXP uint32      CreateContactSheet(CPicture *pPicContactSheet, int32 i32SheetWidth, int32 i32ThumbHeight, const wchar_t *pwcDirectory, bool bIncludeSubDirs, const wchar_t *pwcFileSpec = L"*.*");
    MISCELLANEOUS_EXP bool        DirectoryExists(const wchar_t *pwcDirectory);
    MISCELLANEOUS_EXP HANDLE      EnumeratePortsInit();
    MISCELLANEOUS_EXP bool        EnumeratePortsNext(HANDLE hDeviceInfoSet, wchar_t *pwcPort, int32 i32MaxChars);
    MISCELLANEOUS_EXP bool        FileExists(const wchar_t *pwcFileName);
    MISCELLANEOUS_EXP bool        GetDirName(wchar_t *pwcDirName, int32 i32MaxChars, const wchar_t *pwcTitle = nullptr, HWND hWndParent = NULL);
    MISCELLANEOUS_EXP bool        GetDisplayMonitors(DISPLAY_MONITOR_DIMENSIONS *pDmd);
    MISCELLANEOUS_EXP bool        GetFileName(wchar_t *pwcFileName, int32 i32MaxChars, bool bOpen, const wchar_t *pwcInitialDir = nullptr, bool bAddExtension = true, const wchar_t *pwcExtensionFilter = L"All files (*.*)|*.*", wstring *pWstrDebugLog = nullptr);
    MISCELLANEOUS_EXP int32       GetFilesFromDir(const wchar_t *pwcDir, wchar_t ppwcFiles[][MAX_PATH], int32 i32MaxFiles, const wchar_t *pwcFileSpec = L"*.*");
    MISCELLANEOUS_EXP int32       GetFilesFromDir(const wchar_t *pwcDir, bool bIncludeSubDirs, CDataCube *pDcFiles, int16 i16FilenameCol, const wchar_t *pwcFileSpec = L"*.*");
    MISCELLANEOUS_EXP int64       GetFileSize(const wchar_t *pwcFile);
    MISCELLANEOUS_EXP hostent*    GetHostEnt(const int8 *pi8Address);
    MISCELLANEOUS_EXP int8*       GetIpAddress(int8 *pi8IpAddress, int32 i32MaxChars);
    MISCELLANEOUS_EXP wchar_t*    GetIpAddress(wchar_t *pwcIpAddress, int32 i32MaxChars);
    MISCELLANEOUS_EXP int32       GetMacAddress(MAC_ADDRESS *pMacAddresses, uint8 u8MaxAddresses = 1);
    MISCELLANEOUS_EXP uint32      GetMaxPrintableChars(HDC hDc, const wchar_t *pwcText, int32 i32MaxWidthInPixels);
    MISCELLANEOUS_EXP bool        GetProxyIE(int8 *pi8ProxyIEAdress, int32 i32MaxChars, uint16 *pu16ProxyIEPort);
    MISCELLANEOUS_EXP uint32      GetSubDirsFromDir(const wchar_t *pwcDir, wchar_t ppwcSubDirs[][MAX_PATH], uint32 u32MaxSubDirs, const wchar_t *pwcSubDirSpec = L"*.*");
    MISCELLANEOUS_EXP bool        GetTemporaryFileName(int8 *pi8TempFileName, int32 i32MaxChars);
    MISCELLANEOUS_EXP bool        GetTemporaryFileName(wchar_t *pwcTempFileName, int32 i32MaxChars);
    MISCELLANEOUS_EXP bool        GetWindowsProductId(int8 *pi8ProductId, int32 i32MaxChars);
    MISCELLANEOUS_EXP bool        GetWindowsProductId(wchar_t *pwcProductId, int32 i32MaxChars);
    MISCELLANEOUS_EXP int32       Http_Get(const int8 *pi8Url, uint16 u16Port, uint8 *pu8Data, int32 i32MaxLen, int8 *pi8Header = nullptr, int32 i32MaxHeaderLen = 0);
    MISCELLANEOUS_EXP int32       Http_Get(const wchar_t *pwcUrl, uint16 u16Port, uint8 *pu8Data, int32 i32MaxLen, int8 *pi8Header = nullptr, int32 i32MaxHeaderLen = 0);
    MISCELLANEOUS_EXP int32       Http_Get(const int8 *pi8Url, uint16 u16Port, const wchar_t *pwcDstFile, int8 *pi8Header = nullptr, int32 i32MaxHeaderLen = 0);
    MISCELLANEOUS_EXP int32       Http_Get(const wchar_t *pwcUrl, uint16 u16Port, const wchar_t *pwcDstFile, int8 *pi8Header = nullptr, int32 i32MaxHeaderLen = 0);
    MISCELLANEOUS_EXP RECT*       InitRect(RECT *pRcDst, int32 i32Left, int32 i32Top, int32 i32Width, int32 i32Height);
    MISCELLANEOUS_EXP RECT*       InitRect(RECT *pRcDst, const RECT *pRcSrc = nullptr);
    MISCELLANEOUS_EXP bool        IsSepaCountry(const wchar_t *pwcCountry);
    MISCELLANEOUS_EXP bool        IsValidIpAddress(const int8 *pi8IpAddress);
    MISCELLANEOUS_EXP bool        IsValidIpAddress(const wchar_t *pwcIpAddress);
    MISCELLANEOUS_EXP uint32      KillProcess(const wchar_t *pwcProcessName, uint32 u32MaxProcesses = UINT32_MAX);
    MISCELLANEOUS_EXP void        MoveRect(RECT *pRc, int32 i32OffsetX, int32 i32OffsetY);
    MISCELLANEOUS_EXP bool        PrintText(const wchar_t *pwcText, HWND hWnd, bool bFixedFont, const wchar_t *pwcJobName = nullptr);
    MISCELLANEOUS_EXP bool        SetProcessPrivilege(HANDLE hToken, const wchar_t *pwcPrivilege, bool bEnable);
    MISCELLANEOUS_EXP void        ShowChmHelp(HINSTANCE hInst, HWND hWndParent, wchar_t *pwcHelpFile, uint16 u16TopicId);
    MISCELLANEOUS_EXP void        ShowChmHelpPopup(HINSTANCE hInst, HWND hWndParent, wchar_t *pwcHelpFile, uint16 u16TopicId, const POINT *pPtPos = nullptr);
    MISCELLANEOUS_EXP void        ShowChmHelpPopup(HINSTANCE hInst, HWND hWndParent, const wchar_t *pwcText, const POINT *pPtPos = nullptr);
    MISCELLANEOUS_EXP TASKBAR_POS TaskBar_Hide();
    MISCELLANEOUS_EXP void        TaskBar_Show(TASKBAR_POS eTaskBarPos);
    MISCELLANEOUS_EXP uint32      WMI_GetProperty(const wchar_t *pwcWmiClass, const wchar_t *pwcProperty, wchar_t **ppwcResult, uint32 u32MaxChars, uint32 u32MaxResults);
    
    #ifdef _WIN64
    
      // 64-bit only
      MISCELLANEOUS_EXP int32 WIA_EnumerateDevices();
    
    #else
    
      // 32-bit only
      MISCELLANEOUS_EXP void*  GetThreadInformationBlock();
      MISCELLANEOUS_EXP uint32 KillProcess_Alt(const wchar_t *pwcProcessName, uint32 u32MaxProcesses = UINT32_MAX);
    
    #endif
    
    //--------------------------------------------------------------------------------------------------
    
    // This function swaps 2 elements around
    template <class T> void Swap(T *ptA, T *ptB)
    {
      T tTemp;
    
      // Swap the elements around
      tTemp = *ptA;
      *ptA  = *ptB;
      *ptB  = tTemp;
    }
    
    //--------------------------------------------------------------------------------------------------
    
    // This function swaps 2 structures around
    template <class T> void SwapStructs(T *ptA, T *ptB)
    {
      T tTemp;
    
      // Swap the elements around
      memmove(&tTemp, ptA,    sizeof(T));
      memmove(ptA,    ptB,    sizeof(T));
      memmove(ptB,    &tTemp, sizeof(T));
    }
    
     

    Last edit: Sander Bouwhuis 2016-07-06
  • Mr. X

    Mr. X - 2016-07-07

    I do not get a syntaxError, neither with git head nor with 1.74. Which cppcheck version are you using?

     
  • Sander Bouwhuis

    Sander Bouwhuis - 2016-07-08

    It says v1.74 in the about box. The executable is from 05-Jun-2016 18:33.

     
  • Alexander Mai

    Alexander Mai - 2016-07-09

    Can you reproduce using just your code example? (i.e. without _Export.h)?

     
  • Sander Bouwhuis

    Sander Bouwhuis - 2016-07-12

    Then the error disappears.

    This is _export.h:

    //
    // _Export.h : Definitions file for determining which classes to export
    //
    //
    
    // The exported classes (comment out to not export a class)
    #define CADDRESSBOOK
    #define CBARCODE
    #define CBASE64
    #define CBLUETOOTH
    #define CBUTTONGROUP
    #define CCALCULATOR
    #define CCHART
    #define CCHARTWND
    #define CCHOICEREQUESTERBTN
    #define CCOMM
    #define CCOMMSETTINGS
    #define CCONFIG
    #define CCRC
    #define CCRYPTO_AES
    #define CCRYPTO_AES_MS
    #define CDATABASE
    #define CDATABASEINFO
    #define CDATACODEC
    #define CDATACTRLGROUP
    #define CDATACUBE
    #define CDATE
    #define CDATETIME
    #define CDBPARAMINFO
    #define CDEBUGINFO
    #define CFINGERPRINTENGINE
    #define CFINGERPRINT_DIGITALPERSONA
    #define CFINGERPRINT_LUMIDIGM
    #define CFRACTION
    #define CLIST
    #define CLISTOWNER
    #define CMD4
    #define CMD5
    #define CMESSAGEBOX
    #define CNUMERICPAD
    #define COBJECTPOOL
    #define CONVERTERS
    #define CPICTURE
    #define CPRESENTATION
    #define CPROFILE
    #define CQUERY
    #define CRC
    #define CSALT
    #define CSENDMAIL
    #define CSHA
    #define CSIGNATURE
    #define CSMTP
    #define CSPLASHSCREEN
    #define CSTRINGRESOURCE
    #define CTABORDER
    #define CTCPCLIENT
    #define CTCPSERVER
    #define CTEMPLATEPAGE
    #define CTEXTCTRL
    #define CTIME
    #define CTWAIN
    #define CVALUEREQUESTER
    #define CWHIRLPOOL
    #define CWNDBUTTON
    #define CWNDCOMMON
    #define CWNDTABBAR
    #define CWNDTOOLTIP
    #define ERRORHANDLING
    #define MATHEMATICS
    #define MISCELLANEOUS
    #define SORTING
    #define STRINGHELPER
    #define TRANSLATE_STRINGS
    
     
  • Daniel Marjamäki

    I can't reproduce the syntax error.

    If you use -E cppcheck will print the preprocessor output. Can you try this:

    cppcheck -E file-with-syntax-error.cpp > E.cpp
    cppcheck E.cpp
    

    Do you get syntax error for E.cpp also? does it make more sense in that?

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.