Jump to content

C++ proposition


Jief_Machak
 Share

823 posts in this topic

Recommended Posts

3 hours ago, Slice said:

I committed cbuild.bat to make VS compilation and one example to resolve __typeof__.

As well I disabled warning 4804 in Base.h.

That's all in the moment.

About compilation I install fresh Python3.8.1 for all users (run as administrator) and clean environment variables.

I have to say that new BaseTools is not working. The working one is old provided with Clover.

Can we make

  *HandleType = static_cast<UINT32*>(AllocatePool(*HandleCount * sizeof(UINT32)));

for all compilers?

 

type python in the command line and see the result.

see also edksetup.bat

Link to comment
Share on other sites

15 minutes ago, Slice said:

VOID AddListElement(IN OUT VOID ***ListPtr, IN OUT UINTN *ElementCount, IN VOID *NewElement)
 in the lib.cpp is looks wrong.

Should be switch to list.cpp?

Are talking about the fact I had to cast, line 2150 of menu.cpp ?

That has to be improved. But the best to do it will be when I'll import my template class that'll solve the const problem we have here.

Link to comment
Share on other sites

There is a new problem

d:\projects\clover\rEFIt_UEFI\refit\lib.cpp(345): error C2102: для "&" требуется левостороннее значение
d:\projects\clover\rEFIt_UEFI\refit\lib.cpp(358): error C2102: для "&" требуется левостороннее значение
d:\projects\clover\rEFIt_UEFI\refit\lib.cpp(360): error C2102: для "&" требуется левостороннее значение

it means "required lvalue"

Link to comment
Share on other sites

15 minutes ago, Slice said:

 

type python in the command line and see the result.

see also edksetup.bat

Python path configuration:
  PYTHONHOME = 'd:\Program File\Python38'
  PYTHONPATH = (not set)
  program name = 'python'
  isolated = 0
  environment = 1
  user site = 1
  import site = 1
  sys._base_executable = 'C:\\Users\\jief\\AppData\\Local\\Programs\\Python\\Python38\\python.exe'
  sys.base_prefix = 'd:\\Program File\\Python38'
  sys.base_exec_prefix = 'd:\\Program File\\Python38'
  sys.executable = 'C:\\Users\\jief\\AppData\\Local\\Programs\\Python\\Python38\\python.exe'
  sys.prefix = 'd:\\Program File\\Python38'
  sys.exec_prefix = 'd:\\Program File\\Python38'
  sys.path = [
    'C:\\Users\\jief\\AppData\\Local\\Programs\\Python\\Python38\\python38.zip',
    'd:\\Program File\\Python38\\DLLs',
    'd:\\Program File\\Python38\\lib',
    'C:\\Users\\jief\\AppData\\Local\\Programs\\Python\\Python38',
  ]
Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
Python runtime state: core initialized
ModuleNotFoundError: No module named 'encodings'

Current thread 0x00000278 (most recent call first):
<no Python frame>
 

Link to comment
Share on other sites

"C:\\Users\\jief\\AppData\\Local\\"

it means you installed python for one user while you must install it for all users.

Uninstall it and install again running installer as administrator.

Link to comment
Share on other sites

15 minutes ago, Slice said:

There is a new problem


d:\projects\clover\rEFIt_UEFI\refit\lib.cpp(345): error C2102: для "&" требуется левостороннее значение
d:\projects\clover\rEFIt_UEFI\refit\lib.cpp(358): error C2102: для "&" требуется левостороннее значение
d:\projects\clover\rEFIt_UEFI\refit\lib.cpp(360): error C2102: для "&" требуется левостороннее значение

it means "required lvalue"

Yes, "&" require an lvalue, but line 345,358,360 of lib.cc, there is no "&"

Link to comment
Share on other sites

see cbuild.bat contains D:\Program File\Python38

is it your path?

 

25 minutes ago, Slice said:

There is a new problem


d:\projects\clover\rEFIt_UEFI\refit\lib.cpp(345): error C2102: для "&" требуется левостороннее значение
d:\projects\clover\rEFIt_UEFI\refit\lib.cpp(358): error C2102: для "&" требуется левостороннее значение
d:\projects\clover\rEFIt_UEFI\refit\lib.cpp(360): error C2102: для "&" требуется левостороннее значение

it means "required lvalue"

The error resolved as

**ListPtr = AllocatePool(sizeof(VOID *) * AllocateCount);

Double **!

Link to comment
Share on other sites

9 minutes ago, Jief_Machak said:

still "'build' is not recognized as an internal or external command,
operable program or batch file."

also it is good to close Command Window and open it again.

Link to comment
Share on other sites

16 minutes ago, Slice said:

The error resolved as

**ListPtr = AllocatePool(sizeof(VOID *) * AllocateCount);

Double **!

Original code has *ListPtr = AllocatePool(sizeof(VOID *) * AllocateCount);

Don't know if it was a bug. I can suppose it was not because Clover was working !

so "**ListPtr = AllocatePool(sizeof(VOID *) * AllocateCount);" should be wrong.

Link to comment
Share on other sites

1 hour ago, Jief_Machak said:

Original code has *ListPtr = AllocatePool(sizeof(VOID *) * AllocateCount);

Don't know if it was a bug. I can suppose it was not because Clover was working !

so "**ListPtr = AllocatePool(sizeof(VOID *) * AllocateCount);" should be wrong.

 

The original is correct. ListPtr is VOID **, so it is being dereferenced and set to a new allocated VOID *. Most likely it is a type conversion error if this is vs build and you need to put proper typecasting.

 

EDIT: Because ListPtr is actually ** to some other type.

 

EDIT2: Oh yeah, sizeof(VOID *) == sizeof(VOID **) must be true.

Edited by apianti
Link to comment
Share on other sites

2 hours ago, Slice said:

There is a new problem


d:\projects\clover\rEFIt_UEFI\refit\lib.cpp(345): error C2102: для "&" требуется левостороннее значение
d:\projects\clover\rEFIt_UEFI\refit\lib.cpp(358): error C2102: для "&" требуется левостороннее значение
d:\projects\clover\rEFIt_UEFI\refit\lib.cpp(360): error C2102: для "&" требуется левостороннее значение

it means "required lvalue"

 

It's funny how the structure of Russian is compared to English, lol. That technically says something like `for "&" requires left side value`. I know as much as a Russian third grader.... lol. What are you taking the address of that is NOT a lvalue? A constant?

Link to comment
Share on other sites

1 hour ago, Jief_Machak said:

You should cancel this commit "more type casting fixes" and commit it in a branch.

Remove typeof for explicit cast, removing some CONST... I think it's not best/right thing to do...

I don't want to redo, I want move forward to resolve compilers issues and then to rewrite codes to real cpp.

Link to comment
Share on other sites

 Share

×
×
  • Create New...