bugmake - Bugs: bug #42599, .RECIPEPREFIX should not have to...

 
 

bug #42599: .RECIPEPREFIX should not have to be at beginning of line

Submitter:  Dave Yost <yost>
Submitted:  Sun 22 Jun 2014 08:40:54 PM UTC
   
 
Severity:  3 - Normal Item Group:  Enhancement
Status:  None Privacy:  Public
Assigned to:  None Open/Closed:  Open
Component Version:  4.0 Operating System:  Any
Fixed Release:  None Triage Status:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Mon 07 Jul 2014 07:48:23 AM UTC, comment #3: 

FYI, the error message is a duplicate of bug #41677

Paul D. Smith <psmith>
Group administrator
Fri 27 Jun 2014 07:53:10 PM UTC, comment #2: 

Yeah, I realized later that there is an ambiguity problem. The obvious answer is to allow the prefix char if it is preceded by exactly the same whitespace as the rule line.

I think that's worthwhile.

Dave Yost <yost>
Fri 27 Jun 2014 06:56:32 PM UTC, comment #1: 

FYI, .RECIPEPREFIX was added in GNU make 3.82.

I agree the error message is incorrect.  In fact we shouldn't even be making that extra check in the case where RECIPEPREFIX is set.

I'm not sure I agree with the preceding whitespace request though.  This adds a lot of possibility for error into the parsing: if your recipe prefix happens to match some character at the beginning of the line for example.  What about this:


.RECIPEPREFIX = |
all:
|   find . -type f ... \
       | xargs grep -lv foobar
       | while read f; do echo "file: $$f"; done


See the missing backslash at the end of the "xargs" line?  Currently make will fail because it cannot parse the "while" line (no RECIPEPREFIX).  If we allow leading whitespace then that looks like a recipe line and make will run it... and hang forever because the "read" is trying to read from stdin.

The rule for recipe prefixes is currently very simple: check the single first character on the line and see if it's the recipe introduction character.  Adding the ability to precede it with whitespace is something I'd have to think very carefully about.

Paul D. Smith <psmith>
Group administrator
Sun 22 Jun 2014 08:40:54 PM UTC, original submission:  

.RECIPEPREFIX is a wonderful thing, long overdue. Thanks!

Make should allow the .RECIPEPREFIX character (if it is not a tab) to be preceded by whitespace.


ifneq 'simple' '$(flavor .RECIPEPREFIX)'
  $(error You must use gnu make 4.0 or later)
endif
# This file does not use tabs.
.RECIPEPREFIX := |

ifeq '' ''

  all :
  |   @echo works

endif


gets this error:


0 212 Z% make
Makefile:10: *** missing separator (did you mean TAB instead of 8 spaces?).  Stop.
1 213 Z%


Also it seems to me that this error message needs to be updated for the situation where .RECIPEPREFIX is set to something other than TAB.

Dave Yost <yost>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by psmith (Posted a comment)
  • -email is unavailable- added by yost (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    No changes have been made to this item

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code