Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#78 Orphaned #endif

v5.2
open
Mike Kinghan
None
5
2013-11-03
2013-10-16
vaseo
No

coan.exe, version 5.2 for 64 bit Windows(built Sep 7 2013,16:53:55)
Windows 7 64bit

coan.exe source -UPS1 -UPS2 -V --no-transients -xe -kd -r test.h
coan.exe: progress 0x00101: Processing file (1) "test.h"
coan.exe: test.h: line 7: error 0x00803: Orphan #endif
coan.exe: progress 0x02101: Completed with errors, exit code 0x06

test.h:

ifndef __MNM_MESH_GRID_H

define __MNM_MESH_GRID_H

pragma once

endif // #ifndef __MNM_MESH_GRID_H

Adding empty line to the top of the file fixes the issue:
<empty>

ifndef __MNM_MESH_GRID_H

define __MNM_MESH_GRID_H

pragma once

endif // #ifndef __MNM_MESH_GRID_H

Discussion

  • vaseo
    vaseo
    2013-10-16

    Second version of the code is the same, only with added empty line as the 1st line.

     
  • Mike Kinghan
    Mike Kinghan
    2013-10-17

    I'm not able to reproduce this bug.

    It is not quite certain what the content of test.h should be. I believe that markdown has messed it
    up in the bug report and that it should be.

    #ifndef __MNM_MESH_GRID_H
    #define __MNM_MESH_GRID_H
    #pragma once
    #endif // #ifndef __MNM_MESH_GRID_H
    

    with nothing preceding or following the non-empty lines. When I ran the given commandline on this file the output file was identical to the input, as it should be, and there was no error.

    Removing the -r|--replace option sends the output file to the console. In that case I get:

    C:\develop\coan-5.2\coan\x64\Release>coan source -UPS1 -UPS2 -V --no-transients
    -xe -kd test.h
    coan: while parsing options: warning 0x0041f: The --no-transients option prohibi
    ts coan from taking account of the effects of in-source #define and #undef direc
    tives. Use at your own risk.
    coan: progress 0x00105: Args: source -UPS1 -UPS2 -V --no-transients -xe -kd test
    .h
    coan: progress 0x00102: Building input tree
    coan: progress 0x00103: To do (1) "C:\develop\coan-5.2\coan\x64\Release\test.h"
    coan: progress 0x00104: 1 files to process
    coan: progress 0x00101: Processing file (1) "C:\develop\coan-5.2\coan\x64\Releas
    e\test.h"
    #ifndef __MNM_MESH_GRID_H
    #define __MNM_MESH_GRID_H
    #pragma once
    #endif // #ifndef __MNM_MESH_GRID_H
    
    coan: progress 0x02101: Completed with warnings, exit code 0x02
    coan: info 0x02201: 1 out of 1 input files were reached; 0 files were not reache
    d
    coan: info 0x02202: 1 out of 1 files reached were valid; 0 were abandoned due to
     parse errors
    

    I am attaching the exact file I tested. Can you post as an attachment the exact file that
    is giving you is giving this error?

     
    Attachments
    • vaseo
      vaseo
      2013-10-17

      I see the problem now, it is a unicode leading character at the beginning of the file. When you move the ifdef to a different line, it is fine.

       
      Attachments
  • Mike Kinghan
    Mike Kinghan
    2013-11-03

    • assigned_to: Mike Kinghan