Bug 75165 - compute.c:464:49: error: function definition is not allowed here
Summary: compute.c:464:49: error: function definition is not allowed here
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Other (show other bugs)
Version: unspecified
Hardware: x86-64 (AMD64) All
: medium blocker
Assignee: mesa-dev
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-02-18 18:07 UTC by Vinson Lee
Modified: 2016-01-03 11:23 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Vinson Lee 2014-02-18 18:07:59 UTC
mesa: 20d14ef2633215c5d24741de76b5d59aa3dcbc22 (master)

Build error with clang when enabling gallium tests.

  CC       compute.o
compute.c:464:49: error: function definition is not allowed here
        void init(void *p, int s, int x, int y) {
                                                ^
compute.c:496:27: error: use of undeclared identifier 'expect'
        check_tex(ctx, 0, expect, NULL);
                          ^
compute.c:522:50: error: function definition is not allowed here
        void init0(void *p, int s, int x, int y) {
                                                 ^
compute.c:538:26: error: use of undeclared identifier 'init1'; did you mean
      'init0'?
                 60, 12, init1);
                         ^~~~~
                         init0
compute.c:522:14: note: 'init0' declared here
        void init0(void *p, int s, int x, int y) {
             ^
compute.c:541:27: error: use of undeclared identifier 'expect'
        check_tex(ctx, 1, expect, NULL);
                          ^
compute.c:588:49: error: function definition is not allowed here
        void init(void *p, int s, int x, int y) {
                                                ^
compute.c:602:27: error: use of undeclared identifier 'expect'
        check_tex(ctx, 0, expect, NULL);
                          ^
compute.c:624:49: error: function definition is not allowed here
        void init(void *p, int s, int x, int y) {
                                                ^
compute.c:641:39: error: use of undeclared identifier 'input'
                     (uint32_t *[]){ &input[1], &input[3],
                                      ^
compute.c:641:50: error: use of undeclared identifier 'input'
                     (uint32_t *[]){ &input[1], &input[3],
                                                 ^
compute.c:642:39: error: use of undeclared identifier 'input'
                                     &input[5], &input[7] });
                                      ^
compute.c:642:50: error: use of undeclared identifier 'input'
                                     &input[5], &input[7] });
                                                 ^
compute.c:643:69: error: use of undeclared identifier 'input'
        launch_grid(ctx, (uint []){4, 1, 1}, (uint []){1, 1, 1}, 0, input);
                                                                    ^
compute.c:644:27: error: use of undeclared identifier 'expect'
        check_tex(ctx, 0, expect, NULL);
                          ^
compute.c:645:27: error: use of undeclared identifier 'expect'
        check_tex(ctx, 1, expect, NULL);
                          ^
compute.c:646:27: error: use of undeclared identifier 'expect'
        check_tex(ctx, 2, expect, NULL);
                          ^
compute.c:647:27: error: use of undeclared identifier 'expect'
        check_tex(ctx, 3, expect, NULL);
                          ^
compute.c:694:49: error: function definition is not allowed here
        void init(void *p, int s, int x, int y) {
                                                ^
compute.c:708:27: error: use of undeclared identifier 'expect'
        check_tex(ctx, 0, expect, NULL);
                          ^
Comment 1 Vinson Lee 2014-03-03 23:19:19 UTC
compute.c added in commit 20d14ef2633215c5d24741de76b5d59aa3dcbc22.

commit 309a186987cea7f62dfd41fef66fac6d79fca96c
Author: Francisco Jerez <currojerez@riseup.net>
Date:   Tue Mar 20 23:41:09 2012 +0100

    gallium/tests/trivial: Import compute unit tests.
    
    Add a test program that tries to exercise some of the language
    features commonly used by compute programs at the Gallium API level:
    
       - Correctness of the values returned by the grid parameters.
       - Proper functioning of resource LOADs and STOREs.
       - Subroutine calls.
       - Argument passing to the compute parameter through the INPUT
         memory space.
       - Mapping of buffer objects to the GLOBAL memory space.
       - Proper functioning of the PRIVATE and LOCAL memory spaces.
       - Texture sampling and constant buffers.
       - Support for multiple kernels in the same program.
       - Indirect resource indexing.
       - Formatted resource loads and stores (i.e. with channel conversion
         and scaling) using several different formats.
       - Proper functioning of work-group barriers.
       - Atomicity and semantics of the atomic opcodes.
    
    As of now all of them seem to pass on my nvA8.
Comment 2 Matt Turner 2014-09-21 20:04:49 UTC
Surprised that no one else has noticed this. Still reproducible? If so, with what compiler?
Comment 3 Vinson Lee 2014-10-03 01:06:57 UTC
(In reply to Matt Turner from comment #2)
> Surprised that no one else has noticed this. Still reproducible? If so, with
> what compiler?

mesa: 8df3c02cdc0a81db43f63e5a93fbae1b3435d23d (master 10.4.0-devel)

This build error is still reproducible with clang and --enable-gallium-tests build option.
Comment 4 Samuel Pitoiset 2016-01-03 11:23:41 UTC
Fixed with "gallium/tests: fix build with clang compiler".

http://cgit.freedesktop.org/mesa/mesa/commit/?id=6a49fcfb1f28b563b89f2b37e82d9f87c0671228


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.