Skip to contentSkip to conversation

any reason for "cmake_" prefix on cmake_runcmake_build()?

DISCUSSION Robert P. J. Day 3 participants 6 messages Mar 8, 2021 – Mar 11, 2021

lore
Share & tools
lore
#0 lore raw

collecting some examples of inheritance of class functions using
EXPORT_FUNCTIONS, and ran across this routine in cmake.bbclass:

... snip ...

  cmake_runcmake_build() {
	bbnote ...
	eval ...

}

  cmake_do_compile()  {
        cmake_runcmake_build --target ${OECMAKE_TARGET_COMPILE}
  }
  ... snip ...

what puzzles me is that the routine cmake_runcmake_build(), despite having a "cmake_" prefix, is not being exported with EXPORT_FUNCTIONS, so while that's a perfectly respectable function, it's not clear why it would have a "cmake_" prefix. is there some value to that prefix, or is it just arbitrary?

rday

#1 lore raw
Quoted 15 lines · Robert P. J. Day

collecting some examples of inheritance of class functions using
EXPORT_FUNCTIONS, and ran across this routine in cmake.bbclass:

   ... snip ...
   cmake_runcmake_build() {
	bbnote ...
	eval ...
   }

   cmake_do_compile()  {
         cmake_runcmake_build --target ${OECMAKE_TARGET_COMPILE}
   }
   ... snip ...
Quoted 5 lines

what puzzles me is that the routine cmake_runcmake_build(), despite having a "cmake_" prefix, is not being exported with EXPORT_FUNCTIONS, so while that's a perfectly respectable function, it's not clear why it would have a "cmake_" prefix. is there some value to that prefix, or is it just arbitrary?

it does not intend to provide a default function like do_compile do_install exporting it is not necessary

Quoted 7 lines

rday

#2 lore raw
Quoted 18 lines · Khem Raj
Quoted 15 lines · Robert P. J. Day

collecting some examples of inheritance of class functions using
EXPORT_FUNCTIONS, and ran across this routine in cmake.bbclass:

   ... snip ...
   cmake_runcmake_build() {

bbnote ...
eval ...
}

   cmake_do_compile()  {
         cmake_runcmake_build --target ${OECMAKE_TARGET_COMPILE}
   }
   ... snip ...
Quoted 8 lines
Quoted 5 lines

what puzzles me is that the routine cmake_runcmake_build(), despite having a "cmake_" prefix, is not being exported with EXPORT_FUNCTIONS, so while that's a perfectly respectable function, it's not clear why it would have a "cmake_" prefix. is there some value to that prefix, or is it just arbitrary?

it does not intend to provide a default function like do_compile do_install exporting it is not necessary

no, that part i understand ... the nitpicky observation was the use
of the "cmake_" prefix for a function which was not intended to be exported for the purpose of inheritance. sure, it's perfectly legal, but in a stylistic sense, it just leaves open the possibility of misinterpretation by someone reading the code.

a simpler style rule might be, "reserve classname_ prefixes for only
those routines you plan on exporting." but i admit this is a quibble.

rday

#3 lore raw
Quoted 30 lines · Robert P. J. Day
Quoted 18 lines · Khem Raj
Quoted 15 lines · Robert P. J. Day

collecting some examples of inheritance of class functions using
EXPORT_FUNCTIONS, and ran across this routine in cmake.bbclass:

   ... snip ...
   cmake_runcmake_build() {

bbnote ...
eval ...
}

   cmake_do_compile()  {
         cmake_runcmake_build --target ${OECMAKE_TARGET_COMPILE}
   }
   ... snip ...
Quoted 7 lines
Quoted 5 lines

what puzzles me is that the routine cmake_runcmake_build(), despite having a "cmake_" prefix, is not being exported with EXPORT_FUNCTIONS, so while that's a perfectly respectable function, it's not clear why it would have a "cmake_" prefix. is there some value to that prefix, or is it just arbitrary?

it does not intend to provide a default function like do_compile

do_install

Quoted 1 line

exporting it is not necessary

Quoted 8 lines

no, that part i understand ... the nitpicky observation was the use
of the "cmake_" prefix for a function which was not intended to be exported for the purpose of inheritance. sure, it's perfectly legal, but in a stylistic sense, it just leaves open the possibility of misinterpretation by someone reading the code.

a simpler style rule might be, "reserve classname_ prefixes for only
those routines you plan on exporting." but i admit this is a quibble.

This is more towards code styling issue and we have not really bothered to define such namespaces they cause more confusion than the problem they solve since such things should be checked by linters other wise they fall apart

Quoted 4 lines

rday

#4 lore raw
In reply to Robert P. J. Day
Quoted 29 lines · Robert P. J. Day
Quoted 18 lines · Khem Raj
Quoted 15 lines · Robert P. J. Day

   collecting some examples of inheritance of class functions using EXPORT_FUNCTIONS, and ran across this routine in cmake.bbclass:

   ... snip ...
   cmake_runcmake_build() {
 bbnote ...
 eval ...
   }

   cmake_do_compile() {
         cmake_runcmake_build --target ${OECMAKE_TARGET_COMPILE} }
   ... snip ...

Quoted 8 lines
Quoted 5 lines

what puzzles me is that the routine cmake_runcmake_build(), despite having a "cmake_" prefix, is not being exported with EXPORT_FUNCTIONS, so while that's a perfectly respectable function, it's not clear why it would have a "cmake_" prefix. is there some value to that prefix, or is it just arbitrary?

it does not intend to provide a default function like do_compile do_install exporting it is not necessary

Quoted 8 lines

  no, that part i understand ... the nitpicky observation was the use of the "cmake_" prefix for a function which was not intended to be exported for the purpose of inheritance. sure, it's perfectly legal, but in a stylistic sense, it just leaves open the possibility of misinterpretation by someone reading the code.

  a simpler style rule might be, "reserve classname_ prefixes for only those routines you plan on exporting." but i admit this is a quibble.

No, please lets not do that. Having come kind of standard prefixing for variables/functions in classes does help give people direction to know where to find code from tracebacks or variable definitions and the like.

The use of EXPORT_FUNCTIONS is a bit of a special case which requires the prefixing but I really don't want to see any recommendation we drop all prefixes otherwise.

Cheers,

Richard

#5 lore raw
Quoted 39 lines · Richard Purdie
Quoted 29 lines · Robert P. J. Day
Quoted 18 lines · Khem Raj
Quoted 15 lines · Robert P. J. Day

   collecting some examples of inheritance of class functions using EXPORT_FUNCTIONS, and ran across this routine in cmake.bbclass:

   ... snip ...
   cmake_runcmake_build() {
 bbnote ...
 eval ...
   }

   cmake_do_compile() {
         cmake_runcmake_build --target ${OECMAKE_TARGET_COMPILE} }
   ... snip ...

Quoted 8 lines
Quoted 5 lines

what puzzles me is that the routine cmake_runcmake_build(), despite having a "cmake_" prefix, is not being exported with EXPORT_FUNCTIONS, so while that's a perfectly respectable function, it's not clear why it would have a "cmake_" prefix. is there some value to that prefix, or is it just arbitrary?

it does not intend to provide a default function like do_compile do_install exporting it is not necessary

Quoted 8 lines

  no, that part i understand ... the nitpicky observation was the use of the "cmake_" prefix for a function which was not intended to be exported for the purpose of inheritance. sure, it's perfectly legal, but in a stylistic sense, it just leaves open the possibility of misinterpretation by someone reading the code.

  a simpler style rule might be, "reserve classname_ prefixes for only those routines you plan on exporting." but i admit this is a quibble.

Quoted 8 lines

No, please lets not do that. Having come kind of standard prefixing for variables/functions in classes does help give people direction to know where to find code from tracebacks or variable definitions and the like.

The use of EXPORT_FUNCTIONS is a bit of a special case which requires the prefixing but I really don't want to see any recommendation we drop all prefixes otherwise.

fair, i was probably getting overly pedantic there. moving on ...

rday