View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0014335CMakeCMakepublic2013-08-03 00:432016-06-10 14:31
ReporterRolf Eike Beer 
Assigned ToKitware Robot 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionmoved 
PlatformOSOS Version
Product VersionCMake 2.8.11.2 
Target VersionFixed in Version 
Summary0014335: CMake does not error on duplicate else()
DescriptionThis should definitely give a syntax error as a stray else() also does:

if (foo)
   message(STATUS foo)
else ()
   message(STATUS not foo)
else ()
   message(STATUS funky)
endif ()
TagsNo tags attached.
Attached Files

 Relationships
has duplicate 0015548closed Report syntax error for if/else/else construct 
has duplicate 0015988closed No parse error message on double 'else' contruction 

  Notes
(0040578)
Bartosz (reporter)
2016-02-29 07:14

I would like to fix that issue, and displaying error message while double else() is used in the same condition.

Do you know where I could find source code which is parsing such conditions?
(0040579)
Brad King (manager)
2016-02-29 09:00

I haven't checked in detail but the fix may need to be somewhere near here:

 https://cmake.org/gitweb?p=cmake.git;a=blob;f=Source/cmIfCommand.cxx;hb=v3.4.3#l35 [^]

That function is essentially recording the contents of the if() block until the matching endif().
(0040580)
Mathieu Malaterre (developer)
2016-02-29 09:05

Might a bit off topic, but I'd like to have also the following be fixed (no such thing as `elif`):

$ cat CMakeLists.txt
cmake_minimum_required(VERSION 3.0)

if (foo)
  message(STATUS foo)
elif (TRUE)
  message(STATUS not foo)
endif ()
(0042341)
Kitware Robot (administrator)
2016-06-10 14:29

Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.

 Issue History
Date Modified Username Field Change
2013-08-03 00:43 Rolf Eike Beer New Issue
2015-04-30 03:48 Rolf Eike Beer Relationship added has duplicate 0015548
2016-02-25 13:01 Rolf Eike Beer Relationship added has duplicate 0015988
2016-02-29 07:14 Bartosz Note Added: 0040578
2016-02-29 09:00 Brad King Note Added: 0040579
2016-02-29 09:05 Mathieu Malaterre Note Added: 0040580
2016-06-10 14:29 Kitware Robot Note Added: 0042341
2016-06-10 14:29 Kitware Robot Status new => resolved
2016-06-10 14:29 Kitware Robot Resolution open => moved
2016-06-10 14:29 Kitware Robot Assigned To => Kitware Robot
2016-06-10 14:31 Kitware Robot Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team