* [PATCH] ShellPkg Shell: Remove redundant functions
@ 2018-08-09 5:41 shenglei
2018-08-09 15:34 ` Carsey, Jaben
2018-08-09 15:41 ` Jim.Dailey
0 siblings, 2 replies; 10+ messages in thread
From: shenglei @ 2018-08-09 5:41 UTC (permalink / raw)
To: edk2-devel; +Cc: Jaben Carsey, Ruiyu Ni
The redundant functions which are never called have been
removed. They are InternalShellProtocolDebugPrintMessage,
UpdateFileName,RemoveFileTag and IsValidCommandName.
https://bugzilla.tianocore.org/show_bug.cgi?id=1066
Cc: Jaben Carsey <jaben.carsey@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: shenglei <shenglei.zhang@intel.com>
---
ShellPkg/Application/Shell/Shell.c | 29 -------
ShellPkg/Application/Shell/Shell.h | 13 ---
.../Shell/ShellParametersProtocol.c | 24 ------
ShellPkg/Application/Shell/ShellProtocol.c | 81 +------------------
4 files changed, 1 insertion(+), 146 deletions(-)
diff --git a/ShellPkg/Application/Shell/Shell.c b/ShellPkg/Application/Shell/Shell.c
index 47ae3c373c..397cfd1994 100644
--- a/ShellPkg/Application/Shell/Shell.c
+++ b/ShellPkg/Application/Shell/Shell.c
@@ -2752,35 +2752,6 @@ RunCommand(
STATIC CONST UINT16 InvalidChars[] = {L'*', L'?', L'<', L'>', L'\\', L'/', L'\"', 0x0001, 0x0002};
-/**
- Function determines if the CommandName COULD be a valid command. It does not determine whether
- this is a valid command. It only checks for invalid characters.
-
- @param[in] CommandName The name to check
-
- @retval TRUE CommandName could be a command name
- @retval FALSE CommandName could not be a valid command name
-**/
-BOOLEAN
-IsValidCommandName(
- IN CONST CHAR16 *CommandName
- )
-{
- UINTN Count;
- if (CommandName == NULL) {
- ASSERT(FALSE);
- return (FALSE);
- }
- for ( Count = 0
- ; Count < sizeof(InvalidChars) / sizeof(InvalidChars[0])
- ; Count++
- ){
- if (ScanMem16(CommandName, StrSize(CommandName), InvalidChars[Count]) != NULL) {
- return (FALSE);
- }
- }
- return (TRUE);
-}
/**
Function to process a NSH script file via SHELL_FILE_HANDLE.
diff --git a/ShellPkg/Application/Shell/Shell.h b/ShellPkg/Application/Shell/Shell.h
index 69b19c6a2d..bad8f08d47 100644
--- a/ShellPkg/Application/Shell/Shell.h
+++ b/ShellPkg/Application/Shell/Shell.h
@@ -309,19 +309,6 @@ RunShellCommand(
OUT EFI_STATUS *CommandStatus
);
-/**
- Function determines if the CommandName COULD be a valid command. It does not determine whether
- this is a valid command. It only checks for invalid characters.
-
- @param[in] CommandName The name to check
-
- @retval TRUE CommandName could be a command name
- @retval FALSE CommandName could not be a valid command name
-**/
-BOOLEAN
-IsValidCommandName(
- IN CONST CHAR16 *CommandName
- );
/**
Function to process a NSH script file via SHELL_FILE_HANDLE.
diff --git a/ShellPkg/Application/Shell/ShellParametersProtocol.c b/ShellPkg/Application/Shell/ShellParametersProtocol.c
index 90889a3725..a21c690518 100644
--- a/ShellPkg/Application/Shell/ShellParametersProtocol.c
+++ b/ShellPkg/Application/Shell/ShellParametersProtocol.c
@@ -626,30 +626,6 @@ FixVarName (
return (FixFileName(Copy));
}
-/**
- Remove the unicode file tag from the begining of the file buffer since that will not be
- used by StdIn.
-
- @param[in] Handle Pointer to the handle of the file to be processed.
-
- @retval EFI_SUCCESS The unicode file tag has been moved successfully.
-**/
-EFI_STATUS
-RemoveFileTag(
- IN SHELL_FILE_HANDLE *Handle
- )
-{
- UINTN CharSize;
- CHAR16 CharBuffer;
-
- CharSize = sizeof(CHAR16);
- CharBuffer = 0;
- gEfiShellProtocol->ReadFile(*Handle, &CharSize, &CharBuffer);
- if (CharBuffer != gUnicodeFileTag) {
- gEfiShellProtocol->SetFilePosition(*Handle, 0);
- }
- return (EFI_SUCCESS);
-}
/**
Write the unicode file tag to the specified file.
diff --git a/ShellPkg/Application/Shell/ShellProtocol.c b/ShellPkg/Application/Shell/ShellProtocol.c
index f2ca2029e3..8cf924b384 100644
--- a/ShellPkg/Application/Shell/ShellProtocol.c
+++ b/ShellPkg/Application/Shell/ShellProtocol.c
@@ -98,40 +98,6 @@ InternalShellProtocolIsSimpleFileSystemPresent(
return (FALSE);
}
-/**
- Internal worker debug helper function to print out maps as they are added.
-
- @param[in] Mapping string mapping that has been added
- @param[in] DevicePath pointer to device path that has been mapped.
-
- @retval EFI_SUCCESS the operation was successful.
- @return other an error ocurred
-
- @sa LocateHandle
- @sa OpenProtocol
-**/
-EFI_STATUS
-InternalShellProtocolDebugPrintMessage (
- IN CONST CHAR16 *Mapping,
- IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
- )
-{
- EFI_STATUS Status;
- CHAR16 *Temp;
-
- Status = EFI_SUCCESS;
- DEBUG_CODE_BEGIN();
-
- if (Mapping != NULL) {
- DEBUG((EFI_D_INFO, "Added new map item:\"%S\"\r\n", Mapping));
- }
- Temp = ConvertDevicePathToText(DevicePath, TRUE, TRUE);
- DEBUG((EFI_D_INFO, "DevicePath: %S\r\n", Temp));
- FreePool(Temp);
-
- DEBUG_CODE_END();
- return (Status);
-}
/**
This function creates a mapping for a device path.
@@ -1333,7 +1299,7 @@ EfiShellOpenFileByName(
// We are opening a regular file.
//
DevicePath = EfiShellGetDevicePathFromFilePath(FileName);
-// DEBUG_CODE(InternalShellProtocolDebugPrintMessage (NULL, DevicePath););
+
if (DevicePath == NULL) {
return (EFI_NOT_FOUND);
}
@@ -2261,52 +2227,7 @@ EfiShellGetGuidName(
return (EFI_SUCCESS);
}
-/**
- Updates a file name to be preceeded by the mapped drive name
-
- @param[in] BasePath the Mapped drive name to prepend
- @param[in, out] Path pointer to pointer to the file name to update.
-
- @retval EFI_SUCCESS
- @retval EFI_OUT_OF_RESOURCES
-**/
-EFI_STATUS
-UpdateFileName(
- IN CONST CHAR16 *BasePath,
- IN OUT CHAR16 **Path
- )
-{
- CHAR16 *Path2;
- UINTN Path2Size;
-
- Path2Size = 0;
- Path2 = NULL;
-
- ASSERT(Path != NULL);
- ASSERT(*Path != NULL);
- ASSERT(BasePath != NULL);
-
- //
- // convert a local path to an absolute path
- //
- if (StrStr(*Path, L":") == NULL) {
- ASSERT((Path2 == NULL && Path2Size == 0) || (Path2 != NULL));
- StrnCatGrow(&Path2, &Path2Size, BasePath, 0);
- if (Path2 == NULL) {
- return (EFI_OUT_OF_RESOURCES);
- }
- ASSERT((Path2 == NULL && Path2Size == 0) || (Path2 != NULL));
- StrnCatGrow(&Path2, &Path2Size, (*Path)[0] == L'\\'?(*Path) + 1 :*Path, 0);
- if (Path2 == NULL) {
- return (EFI_OUT_OF_RESOURCES);
- }
- }
-
- FreePool(*Path);
- (*Path) = Path2;
- return (EFI_SUCCESS);
-}
/**
If FileHandle is a directory then the function reads from FileHandle and reads in
--
2.18.0.windows.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH] ShellPkg Shell: Remove redundant functions
2018-08-09 5:41 [PATCH] ShellPkg Shell: Remove redundant functions shenglei
@ 2018-08-09 15:34 ` Carsey, Jaben
2018-08-09 15:41 ` Jim.Dailey
1 sibling, 0 replies; 10+ messages in thread
From: Carsey, Jaben @ 2018-08-09 15:34 UTC (permalink / raw)
To: Zhang, Shenglei, edk2-devel@lists.01.org; +Cc: Ni, Ruiyu
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
> -----Original Message-----
> From: Zhang, Shenglei
> Sent: Wednesday, August 08, 2018 10:42 PM
> To: edk2-devel@lists.01.org
> Cc: Carsey, Jaben <jaben.carsey@intel.com>; Ni, Ruiyu <ruiyu.ni@intel.com>
> Subject: [PATCH] ShellPkg Shell: Remove redundant functions
> Importance: High
>
> The redundant functions which are never called have been
> removed. They are InternalShellProtocolDebugPrintMessage,
> UpdateFileName,RemoveFileTag and IsValidCommandName.
> https://bugzilla.tianocore.org/show_bug.cgi?id=1066
>
> Cc: Jaben Carsey <jaben.carsey@intel.com>
> Cc: Ruiyu Ni <ruiyu.ni@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: shenglei <shenglei.zhang@intel.com>
> ---
> ShellPkg/Application/Shell/Shell.c | 29 -------
> ShellPkg/Application/Shell/Shell.h | 13 ---
> .../Shell/ShellParametersProtocol.c | 24 ------
> ShellPkg/Application/Shell/ShellProtocol.c | 81 +------------------
> 4 files changed, 1 insertion(+), 146 deletions(-)
>
> diff --git a/ShellPkg/Application/Shell/Shell.c
> b/ShellPkg/Application/Shell/Shell.c
> index 47ae3c373c..397cfd1994 100644
> --- a/ShellPkg/Application/Shell/Shell.c
> +++ b/ShellPkg/Application/Shell/Shell.c
> @@ -2752,35 +2752,6 @@ RunCommand(
>
>
> STATIC CONST UINT16 InvalidChars[] = {L'*', L'?', L'<', L'>', L'\\', L'/', L'\"',
> 0x0001, 0x0002};
> -/**
> - Function determines if the CommandName COULD be a valid command. It
> does not determine whether
> - this is a valid command. It only checks for invalid characters.
> -
> - @param[in] CommandName The name to check
> -
> - @retval TRUE CommandName could be a command name
> - @retval FALSE CommandName could not be a valid command name
> -**/
> -BOOLEAN
> -IsValidCommandName(
> - IN CONST CHAR16 *CommandName
> - )
> -{
> - UINTN Count;
> - if (CommandName == NULL) {
> - ASSERT(FALSE);
> - return (FALSE);
> - }
> - for ( Count = 0
> - ; Count < sizeof(InvalidChars) / sizeof(InvalidChars[0])
> - ; Count++
> - ){
> - if (ScanMem16(CommandName, StrSize(CommandName),
> InvalidChars[Count]) != NULL) {
> - return (FALSE);
> - }
> - }
> - return (TRUE);
> -}
>
> /**
> Function to process a NSH script file via SHELL_FILE_HANDLE.
> diff --git a/ShellPkg/Application/Shell/Shell.h
> b/ShellPkg/Application/Shell/Shell.h
> index 69b19c6a2d..bad8f08d47 100644
> --- a/ShellPkg/Application/Shell/Shell.h
> +++ b/ShellPkg/Application/Shell/Shell.h
> @@ -309,19 +309,6 @@ RunShellCommand(
> OUT EFI_STATUS *CommandStatus
> );
>
> -/**
> - Function determines if the CommandName COULD be a valid command. It
> does not determine whether
> - this is a valid command. It only checks for invalid characters.
> -
> - @param[in] CommandName The name to check
> -
> - @retval TRUE CommandName could be a command name
> - @retval FALSE CommandName could not be a valid command name
> -**/
> -BOOLEAN
> -IsValidCommandName(
> - IN CONST CHAR16 *CommandName
> - );
>
> /**
> Function to process a NSH script file via SHELL_FILE_HANDLE.
> diff --git a/ShellPkg/Application/Shell/ShellParametersProtocol.c
> b/ShellPkg/Application/Shell/ShellParametersProtocol.c
> index 90889a3725..a21c690518 100644
> --- a/ShellPkg/Application/Shell/ShellParametersProtocol.c
> +++ b/ShellPkg/Application/Shell/ShellParametersProtocol.c
> @@ -626,30 +626,6 @@ FixVarName (
> return (FixFileName(Copy));
> }
>
> -/**
> - Remove the unicode file tag from the begining of the file buffer since that
> will not be
> - used by StdIn.
> -
> - @param[in] Handle Pointer to the handle of the file to be processed.
> -
> - @retval EFI_SUCCESS The unicode file tag has been moved successfully.
> -**/
> -EFI_STATUS
> -RemoveFileTag(
> - IN SHELL_FILE_HANDLE *Handle
> - )
> -{
> - UINTN CharSize;
> - CHAR16 CharBuffer;
> -
> - CharSize = sizeof(CHAR16);
> - CharBuffer = 0;
> - gEfiShellProtocol->ReadFile(*Handle, &CharSize, &CharBuffer);
> - if (CharBuffer != gUnicodeFileTag) {
> - gEfiShellProtocol->SetFilePosition(*Handle, 0);
> - }
> - return (EFI_SUCCESS);
> -}
>
> /**
> Write the unicode file tag to the specified file.
> diff --git a/ShellPkg/Application/Shell/ShellProtocol.c
> b/ShellPkg/Application/Shell/ShellProtocol.c
> index f2ca2029e3..8cf924b384 100644
> --- a/ShellPkg/Application/Shell/ShellProtocol.c
> +++ b/ShellPkg/Application/Shell/ShellProtocol.c
> @@ -98,40 +98,6 @@ InternalShellProtocolIsSimpleFileSystemPresent(
> return (FALSE);
> }
>
> -/**
> - Internal worker debug helper function to print out maps as they are added.
> -
> - @param[in] Mapping string mapping that has been added
> - @param[in] DevicePath pointer to device path that has been mapped.
> -
> - @retval EFI_SUCCESS the operation was successful.
> - @return other an error ocurred
> -
> - @sa LocateHandle
> - @sa OpenProtocol
> -**/
> -EFI_STATUS
> -InternalShellProtocolDebugPrintMessage (
> - IN CONST CHAR16 *Mapping,
> - IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
> - )
> -{
> - EFI_STATUS Status;
> - CHAR16 *Temp;
> -
> - Status = EFI_SUCCESS;
> - DEBUG_CODE_BEGIN();
> -
> - if (Mapping != NULL) {
> - DEBUG((EFI_D_INFO, "Added new map item:\"%S\"\r\n", Mapping));
> - }
> - Temp = ConvertDevicePathToText(DevicePath, TRUE, TRUE);
> - DEBUG((EFI_D_INFO, "DevicePath: %S\r\n", Temp));
> - FreePool(Temp);
> -
> - DEBUG_CODE_END();
> - return (Status);
> -}
>
> /**
> This function creates a mapping for a device path.
> @@ -1333,7 +1299,7 @@ EfiShellOpenFileByName(
> // We are opening a regular file.
> //
> DevicePath = EfiShellGetDevicePathFromFilePath(FileName);
> -// DEBUG_CODE(InternalShellProtocolDebugPrintMessage (NULL,
> DevicePath););
> +
> if (DevicePath == NULL) {
> return (EFI_NOT_FOUND);
> }
> @@ -2261,52 +2227,7 @@ EfiShellGetGuidName(
> return (EFI_SUCCESS);
> }
>
> -/**
> - Updates a file name to be preceeded by the mapped drive name
> -
> - @param[in] BasePath the Mapped drive name to prepend
> - @param[in, out] Path pointer to pointer to the file name to update.
> -
> - @retval EFI_SUCCESS
> - @retval EFI_OUT_OF_RESOURCES
> -**/
> -EFI_STATUS
> -UpdateFileName(
> - IN CONST CHAR16 *BasePath,
> - IN OUT CHAR16 **Path
> - )
> -{
> - CHAR16 *Path2;
> - UINTN Path2Size;
> -
> - Path2Size = 0;
> - Path2 = NULL;
> -
> - ASSERT(Path != NULL);
> - ASSERT(*Path != NULL);
> - ASSERT(BasePath != NULL);
> -
> - //
> - // convert a local path to an absolute path
> - //
> - if (StrStr(*Path, L":") == NULL) {
> - ASSERT((Path2 == NULL && Path2Size == 0) || (Path2 != NULL));
> - StrnCatGrow(&Path2, &Path2Size, BasePath, 0);
> - if (Path2 == NULL) {
> - return (EFI_OUT_OF_RESOURCES);
> - }
> - ASSERT((Path2 == NULL && Path2Size == 0) || (Path2 != NULL));
> - StrnCatGrow(&Path2, &Path2Size, (*Path)[0] == L'\\'?(*Path) + 1 :*Path,
> 0);
> - if (Path2 == NULL) {
> - return (EFI_OUT_OF_RESOURCES);
> - }
> - }
> -
> - FreePool(*Path);
> - (*Path) = Path2;
>
> - return (EFI_SUCCESS);
> -}
>
> /**
> If FileHandle is a directory then the function reads from FileHandle and
> reads in
> --
> 2.18.0.windows.1
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] ShellPkg Shell: Remove redundant functions
2018-08-09 5:41 [PATCH] ShellPkg Shell: Remove redundant functions shenglei
2018-08-09 15:34 ` Carsey, Jaben
@ 2018-08-09 15:41 ` Jim.Dailey
2018-08-09 16:17 ` Laszlo Ersek
2018-09-06 10:28 ` Ard Biesheuvel
1 sibling, 2 replies; 10+ messages in thread
From: Jim.Dailey @ 2018-08-09 15:41 UTC (permalink / raw)
To: shenglei.zhang; +Cc: jaben.carsey, ruiyu.ni, edk2-devel
The InvalidChars[] array is only used in function IsValidCommandName().
The array should be deleted also, I think.
Regards,
Jim
-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of shenglei
Sent: Thursday, August 9, 2018 12:42 AM
To: edk2-devel@lists.01.org
Cc: Jaben Carsey; Ruiyu Ni
Subject: [edk2] [PATCH] ShellPkg Shell: Remove redundant functions
The redundant functions which are never called have been
removed. They are InternalShellProtocolDebugPrintMessage,
UpdateFileName,RemoveFileTag and IsValidCommandName.
https://bugzilla.tianocore.org/show_bug.cgi?id=1066
Cc: Jaben Carsey <jaben.carsey@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: shenglei <shenglei.zhang@intel.com>
---
ShellPkg/Application/Shell/Shell.c | 29 -------
ShellPkg/Application/Shell/Shell.h | 13 ---
.../Shell/ShellParametersProtocol.c | 24 ------
ShellPkg/Application/Shell/ShellProtocol.c | 81 +------------------
4 files changed, 1 insertion(+), 146 deletions(-)
diff --git a/ShellPkg/Application/Shell/Shell.c b/ShellPkg/Application/Shell/Shell.c
index 47ae3c373c..397cfd1994 100644
--- a/ShellPkg/Application/Shell/Shell.c
+++ b/ShellPkg/Application/Shell/Shell.c
@@ -2752,35 +2752,6 @@ RunCommand(
STATIC CONST UINT16 InvalidChars[] = {L'*', L'?', L'<', L'>', L'\\', L'/', L'\"', 0x0001, 0x0002};
-/**
- Function determines if the CommandName COULD be a valid command. It does not determine whether
- this is a valid command. It only checks for invalid characters.
-
- @param[in] CommandName The name to check
-
- @retval TRUE CommandName could be a command name
- @retval FALSE CommandName could not be a valid command name
-**/
-BOOLEAN
-IsValidCommandName(
- IN CONST CHAR16 *CommandName
- )
-{
- UINTN Count;
- if (CommandName == NULL) {
- ASSERT(FALSE);
- return (FALSE);
- }
- for ( Count = 0
- ; Count < sizeof(InvalidChars) / sizeof(InvalidChars[0])
- ; Count++
- ){
- if (ScanMem16(CommandName, StrSize(CommandName), InvalidChars[Count]) != NULL) {
- return (FALSE);
- }
- }
- return (TRUE);
-}
/**
Function to process a NSH script file via SHELL_FILE_HANDLE.
diff --git a/ShellPkg/Application/Shell/Shell.h b/ShellPkg/Application/Shell/Shell.h
index 69b19c6a2d..bad8f08d47 100644
--- a/ShellPkg/Application/Shell/Shell.h
+++ b/ShellPkg/Application/Shell/Shell.h
@@ -309,19 +309,6 @@ RunShellCommand(
OUT EFI_STATUS *CommandStatus
);
-/**
- Function determines if the CommandName COULD be a valid command. It does not determine whether
- this is a valid command. It only checks for invalid characters.
-
- @param[in] CommandName The name to check
-
- @retval TRUE CommandName could be a command name
- @retval FALSE CommandName could not be a valid command name
-**/
-BOOLEAN
-IsValidCommandName(
- IN CONST CHAR16 *CommandName
- );
/**
Function to process a NSH script file via SHELL_FILE_HANDLE.
diff --git a/ShellPkg/Application/Shell/ShellParametersProtocol.c b/ShellPkg/Application/Shell/ShellParametersProtocol.c
index 90889a3725..a21c690518 100644
--- a/ShellPkg/Application/Shell/ShellParametersProtocol.c
+++ b/ShellPkg/Application/Shell/ShellParametersProtocol.c
@@ -626,30 +626,6 @@ FixVarName (
return (FixFileName(Copy));
}
-/**
- Remove the unicode file tag from the begining of the file buffer since that will not be
- used by StdIn.
-
- @param[in] Handle Pointer to the handle of the file to be processed.
-
- @retval EFI_SUCCESS The unicode file tag has been moved successfully.
-**/
-EFI_STATUS
-RemoveFileTag(
- IN SHELL_FILE_HANDLE *Handle
- )
-{
- UINTN CharSize;
- CHAR16 CharBuffer;
-
- CharSize = sizeof(CHAR16);
- CharBuffer = 0;
- gEfiShellProtocol->ReadFile(*Handle, &CharSize, &CharBuffer);
- if (CharBuffer != gUnicodeFileTag) {
- gEfiShellProtocol->SetFilePosition(*Handle, 0);
- }
- return (EFI_SUCCESS);
-}
/**
Write the unicode file tag to the specified file.
diff --git a/ShellPkg/Application/Shell/ShellProtocol.c b/ShellPkg/Application/Shell/ShellProtocol.c
index f2ca2029e3..8cf924b384 100644
--- a/ShellPkg/Application/Shell/ShellProtocol.c
+++ b/ShellPkg/Application/Shell/ShellProtocol.c
@@ -98,40 +98,6 @@ InternalShellProtocolIsSimpleFileSystemPresent(
return (FALSE);
}
-/**
- Internal worker debug helper function to print out maps as they are added.
-
- @param[in] Mapping string mapping that has been added
- @param[in] DevicePath pointer to device path that has been mapped.
-
- @retval EFI_SUCCESS the operation was successful.
- @return other an error ocurred
-
- @sa LocateHandle
- @sa OpenProtocol
-**/
-EFI_STATUS
-InternalShellProtocolDebugPrintMessage (
- IN CONST CHAR16 *Mapping,
- IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
- )
-{
- EFI_STATUS Status;
- CHAR16 *Temp;
-
- Status = EFI_SUCCESS;
- DEBUG_CODE_BEGIN();
-
- if (Mapping != NULL) {
- DEBUG((EFI_D_INFO, "Added new map item:\"%S\"\r\n", Mapping));
- }
- Temp = ConvertDevicePathToText(DevicePath, TRUE, TRUE);
- DEBUG((EFI_D_INFO, "DevicePath: %S\r\n", Temp));
- FreePool(Temp);
-
- DEBUG_CODE_END();
- return (Status);
-}
/**
This function creates a mapping for a device path.
@@ -1333,7 +1299,7 @@ EfiShellOpenFileByName(
// We are opening a regular file.
//
DevicePath = EfiShellGetDevicePathFromFilePath(FileName);
-// DEBUG_CODE(InternalShellProtocolDebugPrintMessage (NULL, DevicePath););
+
if (DevicePath == NULL) {
return (EFI_NOT_FOUND);
}
@@ -2261,52 +2227,7 @@ EfiShellGetGuidName(
return (EFI_SUCCESS);
}
-/**
- Updates a file name to be preceeded by the mapped drive name
-
- @param[in] BasePath the Mapped drive name to prepend
- @param[in, out] Path pointer to pointer to the file name to update.
-
- @retval EFI_SUCCESS
- @retval EFI_OUT_OF_RESOURCES
-**/
-EFI_STATUS
-UpdateFileName(
- IN CONST CHAR16 *BasePath,
- IN OUT CHAR16 **Path
- )
-{
- CHAR16 *Path2;
- UINTN Path2Size;
-
- Path2Size = 0;
- Path2 = NULL;
-
- ASSERT(Path != NULL);
- ASSERT(*Path != NULL);
- ASSERT(BasePath != NULL);
-
- //
- // convert a local path to an absolute path
- //
- if (StrStr(*Path, L":") == NULL) {
- ASSERT((Path2 == NULL && Path2Size == 0) || (Path2 != NULL));
- StrnCatGrow(&Path2, &Path2Size, BasePath, 0);
- if (Path2 == NULL) {
- return (EFI_OUT_OF_RESOURCES);
- }
- ASSERT((Path2 == NULL && Path2Size == 0) || (Path2 != NULL));
- StrnCatGrow(&Path2, &Path2Size, (*Path)[0] == L'\\'?(*Path) + 1 :*Path, 0);
- if (Path2 == NULL) {
- return (EFI_OUT_OF_RESOURCES);
- }
- }
-
- FreePool(*Path);
- (*Path) = Path2;
- return (EFI_SUCCESS);
-}
/**
If FileHandle is a directory then the function reads from FileHandle and reads in
--
2.18.0.windows.1
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH] ShellPkg Shell: Remove redundant functions
2018-08-09 15:41 ` Jim.Dailey
@ 2018-08-09 16:17 ` Laszlo Ersek
2018-09-06 10:28 ` Ard Biesheuvel
1 sibling, 0 replies; 10+ messages in thread
From: Laszlo Ersek @ 2018-08-09 16:17 UTC (permalink / raw)
To: Jim.Dailey, shenglei.zhang; +Cc: jaben.carsey, ruiyu.ni, edk2-devel
On 08/09/18 17:41, Jim.Dailey@dell.com wrote:
> The InvalidChars[] array is only used in function IsValidCommandName().
> The array should be deleted also, I think.
I've pointed out a similar continuation for another patch:
http://mid.mail-archive.com/141a93ac-e2e0-0987-82ee-3fe4533e84a3@redhat.com
However, as far as I understand, these BZs mainly focus on the uncalled
functions that were revealed / flagged by a "UEFI-aware compiler". I
think it's fine to clean up those functions first. If some global
variables become practically unused afterwards, I think it's OK to split
such further cleanup to different BZs, or at least to different patches.
IOW, I think pointing out such loose ends is very valuable, but they
shouldn't block the current patch set(s).
Thanks!
Laszlo
> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of shenglei
> Sent: Thursday, August 9, 2018 12:42 AM
> To: edk2-devel@lists.01.org
> Cc: Jaben Carsey; Ruiyu Ni
> Subject: [edk2] [PATCH] ShellPkg Shell: Remove redundant functions
>
> The redundant functions which are never called have been
> removed. They are InternalShellProtocolDebugPrintMessage,
> UpdateFileName,RemoveFileTag and IsValidCommandName.
> https://bugzilla.tianocore.org/show_bug.cgi?id=1066
>
> Cc: Jaben Carsey <jaben.carsey@intel.com>
> Cc: Ruiyu Ni <ruiyu.ni@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: shenglei <shenglei.zhang@intel.com>
> ---
> ShellPkg/Application/Shell/Shell.c | 29 -------
> ShellPkg/Application/Shell/Shell.h | 13 ---
> .../Shell/ShellParametersProtocol.c | 24 ------
> ShellPkg/Application/Shell/ShellProtocol.c | 81 +------------------
> 4 files changed, 1 insertion(+), 146 deletions(-)
>
> diff --git a/ShellPkg/Application/Shell/Shell.c b/ShellPkg/Application/Shell/Shell.c
> index 47ae3c373c..397cfd1994 100644
> --- a/ShellPkg/Application/Shell/Shell.c
> +++ b/ShellPkg/Application/Shell/Shell.c
> @@ -2752,35 +2752,6 @@ RunCommand(
>
>
> STATIC CONST UINT16 InvalidChars[] = {L'*', L'?', L'<', L'>', L'\\', L'/', L'\"', 0x0001, 0x0002};
> -/**
> - Function determines if the CommandName COULD be a valid command. It does not determine whether
> - this is a valid command. It only checks for invalid characters.
> -
> - @param[in] CommandName The name to check
> -
> - @retval TRUE CommandName could be a command name
> - @retval FALSE CommandName could not be a valid command name
> -**/
> -BOOLEAN
> -IsValidCommandName(
> - IN CONST CHAR16 *CommandName
> - )
> -{
> - UINTN Count;
> - if (CommandName == NULL) {
> - ASSERT(FALSE);
> - return (FALSE);
> - }
> - for ( Count = 0
> - ; Count < sizeof(InvalidChars) / sizeof(InvalidChars[0])
> - ; Count++
> - ){
> - if (ScanMem16(CommandName, StrSize(CommandName), InvalidChars[Count]) != NULL) {
> - return (FALSE);
> - }
> - }
> - return (TRUE);
> -}
>
> /**
> Function to process a NSH script file via SHELL_FILE_HANDLE.
> diff --git a/ShellPkg/Application/Shell/Shell.h b/ShellPkg/Application/Shell/Shell.h
> index 69b19c6a2d..bad8f08d47 100644
> --- a/ShellPkg/Application/Shell/Shell.h
> +++ b/ShellPkg/Application/Shell/Shell.h
> @@ -309,19 +309,6 @@ RunShellCommand(
> OUT EFI_STATUS *CommandStatus
> );
>
> -/**
> - Function determines if the CommandName COULD be a valid command. It does not determine whether
> - this is a valid command. It only checks for invalid characters.
> -
> - @param[in] CommandName The name to check
> -
> - @retval TRUE CommandName could be a command name
> - @retval FALSE CommandName could not be a valid command name
> -**/
> -BOOLEAN
> -IsValidCommandName(
> - IN CONST CHAR16 *CommandName
> - );
>
> /**
> Function to process a NSH script file via SHELL_FILE_HANDLE.
> diff --git a/ShellPkg/Application/Shell/ShellParametersProtocol.c b/ShellPkg/Application/Shell/ShellParametersProtocol.c
> index 90889a3725..a21c690518 100644
> --- a/ShellPkg/Application/Shell/ShellParametersProtocol.c
> +++ b/ShellPkg/Application/Shell/ShellParametersProtocol.c
> @@ -626,30 +626,6 @@ FixVarName (
> return (FixFileName(Copy));
> }
>
> -/**
> - Remove the unicode file tag from the begining of the file buffer since that will not be
> - used by StdIn.
> -
> - @param[in] Handle Pointer to the handle of the file to be processed.
> -
> - @retval EFI_SUCCESS The unicode file tag has been moved successfully.
> -**/
> -EFI_STATUS
> -RemoveFileTag(
> - IN SHELL_FILE_HANDLE *Handle
> - )
> -{
> - UINTN CharSize;
> - CHAR16 CharBuffer;
> -
> - CharSize = sizeof(CHAR16);
> - CharBuffer = 0;
> - gEfiShellProtocol->ReadFile(*Handle, &CharSize, &CharBuffer);
> - if (CharBuffer != gUnicodeFileTag) {
> - gEfiShellProtocol->SetFilePosition(*Handle, 0);
> - }
> - return (EFI_SUCCESS);
> -}
>
> /**
> Write the unicode file tag to the specified file.
> diff --git a/ShellPkg/Application/Shell/ShellProtocol.c b/ShellPkg/Application/Shell/ShellProtocol.c
> index f2ca2029e3..8cf924b384 100644
> --- a/ShellPkg/Application/Shell/ShellProtocol.c
> +++ b/ShellPkg/Application/Shell/ShellProtocol.c
> @@ -98,40 +98,6 @@ InternalShellProtocolIsSimpleFileSystemPresent(
> return (FALSE);
> }
>
> -/**
> - Internal worker debug helper function to print out maps as they are added.
> -
> - @param[in] Mapping string mapping that has been added
> - @param[in] DevicePath pointer to device path that has been mapped.
> -
> - @retval EFI_SUCCESS the operation was successful.
> - @return other an error ocurred
> -
> - @sa LocateHandle
> - @sa OpenProtocol
> -**/
> -EFI_STATUS
> -InternalShellProtocolDebugPrintMessage (
> - IN CONST CHAR16 *Mapping,
> - IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
> - )
> -{
> - EFI_STATUS Status;
> - CHAR16 *Temp;
> -
> - Status = EFI_SUCCESS;
> - DEBUG_CODE_BEGIN();
> -
> - if (Mapping != NULL) {
> - DEBUG((EFI_D_INFO, "Added new map item:\"%S\"\r\n", Mapping));
> - }
> - Temp = ConvertDevicePathToText(DevicePath, TRUE, TRUE);
> - DEBUG((EFI_D_INFO, "DevicePath: %S\r\n", Temp));
> - FreePool(Temp);
> -
> - DEBUG_CODE_END();
> - return (Status);
> -}
>
> /**
> This function creates a mapping for a device path.
> @@ -1333,7 +1299,7 @@ EfiShellOpenFileByName(
> // We are opening a regular file.
> //
> DevicePath = EfiShellGetDevicePathFromFilePath(FileName);
> -// DEBUG_CODE(InternalShellProtocolDebugPrintMessage (NULL, DevicePath););
> +
> if (DevicePath == NULL) {
> return (EFI_NOT_FOUND);
> }
> @@ -2261,52 +2227,7 @@ EfiShellGetGuidName(
> return (EFI_SUCCESS);
> }
>
> -/**
> - Updates a file name to be preceeded by the mapped drive name
> -
> - @param[in] BasePath the Mapped drive name to prepend
> - @param[in, out] Path pointer to pointer to the file name to update.
> -
> - @retval EFI_SUCCESS
> - @retval EFI_OUT_OF_RESOURCES
> -**/
> -EFI_STATUS
> -UpdateFileName(
> - IN CONST CHAR16 *BasePath,
> - IN OUT CHAR16 **Path
> - )
> -{
> - CHAR16 *Path2;
> - UINTN Path2Size;
> -
> - Path2Size = 0;
> - Path2 = NULL;
> -
> - ASSERT(Path != NULL);
> - ASSERT(*Path != NULL);
> - ASSERT(BasePath != NULL);
> -
> - //
> - // convert a local path to an absolute path
> - //
> - if (StrStr(*Path, L":") == NULL) {
> - ASSERT((Path2 == NULL && Path2Size == 0) || (Path2 != NULL));
> - StrnCatGrow(&Path2, &Path2Size, BasePath, 0);
> - if (Path2 == NULL) {
> - return (EFI_OUT_OF_RESOURCES);
> - }
> - ASSERT((Path2 == NULL && Path2Size == 0) || (Path2 != NULL));
> - StrnCatGrow(&Path2, &Path2Size, (*Path)[0] == L'\\'?(*Path) + 1 :*Path, 0);
> - if (Path2 == NULL) {
> - return (EFI_OUT_OF_RESOURCES);
> - }
> - }
> -
> - FreePool(*Path);
> - (*Path) = Path2;
>
> - return (EFI_SUCCESS);
> -}
>
> /**
> If FileHandle is a directory then the function reads from FileHandle and reads in
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] ShellPkg Shell: Remove redundant functions
2018-08-09 15:41 ` Jim.Dailey
2018-08-09 16:17 ` Laszlo Ersek
@ 2018-09-06 10:28 ` Ard Biesheuvel
2018-09-06 12:24 ` Laszlo Ersek
1 sibling, 1 reply; 10+ messages in thread
From: Ard Biesheuvel @ 2018-09-06 10:28 UTC (permalink / raw)
To: Jim.Dailey
Cc: Zhang, Shenglei, Carsey, Jaben, Ruiyu Ni, edk2-devel@lists.01.org
On 9 August 2018 at 17:41, <Jim.Dailey@dell.com> wrote:
> The InvalidChars[] array is only used in function IsValidCommandName().
> The array should be deleted also, I think.
>
Indeed, and for this reason this patch has now broken the build for
clang. Please fix.
>
> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of shenglei
> Sent: Thursday, August 9, 2018 12:42 AM
> To: edk2-devel@lists.01.org
> Cc: Jaben Carsey; Ruiyu Ni
> Subject: [edk2] [PATCH] ShellPkg Shell: Remove redundant functions
>
> The redundant functions which are never called have been
> removed. They are InternalShellProtocolDebugPrintMessage,
> UpdateFileName,RemoveFileTag and IsValidCommandName.
> https://bugzilla.tianocore.org/show_bug.cgi?id=1066
>
> Cc: Jaben Carsey <jaben.carsey@intel.com>
> Cc: Ruiyu Ni <ruiyu.ni@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: shenglei <shenglei.zhang@intel.com>
> ---
> ShellPkg/Application/Shell/Shell.c | 29 -------
> ShellPkg/Application/Shell/Shell.h | 13 ---
> .../Shell/ShellParametersProtocol.c | 24 ------
> ShellPkg/Application/Shell/ShellProtocol.c | 81 +------------------
> 4 files changed, 1 insertion(+), 146 deletions(-)
>
> diff --git a/ShellPkg/Application/Shell/Shell.c b/ShellPkg/Application/Shell/Shell.c
> index 47ae3c373c..397cfd1994 100644
> --- a/ShellPkg/Application/Shell/Shell.c
> +++ b/ShellPkg/Application/Shell/Shell.c
> @@ -2752,35 +2752,6 @@ RunCommand(
>
>
> STATIC CONST UINT16 InvalidChars[] = {L'*', L'?', L'<', L'>', L'\\', L'/', L'\"', 0x0001, 0x0002};
> -/**
> - Function determines if the CommandName COULD be a valid command. It does not determine whether
> - this is a valid command. It only checks for invalid characters.
> -
> - @param[in] CommandName The name to check
> -
> - @retval TRUE CommandName could be a command name
> - @retval FALSE CommandName could not be a valid command name
> -**/
> -BOOLEAN
> -IsValidCommandName(
> - IN CONST CHAR16 *CommandName
> - )
> -{
> - UINTN Count;
> - if (CommandName == NULL) {
> - ASSERT(FALSE);
> - return (FALSE);
> - }
> - for ( Count = 0
> - ; Count < sizeof(InvalidChars) / sizeof(InvalidChars[0])
> - ; Count++
> - ){
> - if (ScanMem16(CommandName, StrSize(CommandName), InvalidChars[Count]) != NULL) {
> - return (FALSE);
> - }
> - }
> - return (TRUE);
> -}
>
> /**
> Function to process a NSH script file via SHELL_FILE_HANDLE.
> diff --git a/ShellPkg/Application/Shell/Shell.h b/ShellPkg/Application/Shell/Shell.h
> index 69b19c6a2d..bad8f08d47 100644
> --- a/ShellPkg/Application/Shell/Shell.h
> +++ b/ShellPkg/Application/Shell/Shell.h
> @@ -309,19 +309,6 @@ RunShellCommand(
> OUT EFI_STATUS *CommandStatus
> );
>
> -/**
> - Function determines if the CommandName COULD be a valid command. It does not determine whether
> - this is a valid command. It only checks for invalid characters.
> -
> - @param[in] CommandName The name to check
> -
> - @retval TRUE CommandName could be a command name
> - @retval FALSE CommandName could not be a valid command name
> -**/
> -BOOLEAN
> -IsValidCommandName(
> - IN CONST CHAR16 *CommandName
> - );
>
> /**
> Function to process a NSH script file via SHELL_FILE_HANDLE.
> diff --git a/ShellPkg/Application/Shell/ShellParametersProtocol.c b/ShellPkg/Application/Shell/ShellParametersProtocol.c
> index 90889a3725..a21c690518 100644
> --- a/ShellPkg/Application/Shell/ShellParametersProtocol.c
> +++ b/ShellPkg/Application/Shell/ShellParametersProtocol.c
> @@ -626,30 +626,6 @@ FixVarName (
> return (FixFileName(Copy));
> }
>
> -/**
> - Remove the unicode file tag from the begining of the file buffer since that will not be
> - used by StdIn.
> -
> - @param[in] Handle Pointer to the handle of the file to be processed.
> -
> - @retval EFI_SUCCESS The unicode file tag has been moved successfully.
> -**/
> -EFI_STATUS
> -RemoveFileTag(
> - IN SHELL_FILE_HANDLE *Handle
> - )
> -{
> - UINTN CharSize;
> - CHAR16 CharBuffer;
> -
> - CharSize = sizeof(CHAR16);
> - CharBuffer = 0;
> - gEfiShellProtocol->ReadFile(*Handle, &CharSize, &CharBuffer);
> - if (CharBuffer != gUnicodeFileTag) {
> - gEfiShellProtocol->SetFilePosition(*Handle, 0);
> - }
> - return (EFI_SUCCESS);
> -}
>
> /**
> Write the unicode file tag to the specified file.
> diff --git a/ShellPkg/Application/Shell/ShellProtocol.c b/ShellPkg/Application/Shell/ShellProtocol.c
> index f2ca2029e3..8cf924b384 100644
> --- a/ShellPkg/Application/Shell/ShellProtocol.c
> +++ b/ShellPkg/Application/Shell/ShellProtocol.c
> @@ -98,40 +98,6 @@ InternalShellProtocolIsSimpleFileSystemPresent(
> return (FALSE);
> }
>
> -/**
> - Internal worker debug helper function to print out maps as they are added.
> -
> - @param[in] Mapping string mapping that has been added
> - @param[in] DevicePath pointer to device path that has been mapped.
> -
> - @retval EFI_SUCCESS the operation was successful.
> - @return other an error ocurred
> -
> - @sa LocateHandle
> - @sa OpenProtocol
> -**/
> -EFI_STATUS
> -InternalShellProtocolDebugPrintMessage (
> - IN CONST CHAR16 *Mapping,
> - IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
> - )
> -{
> - EFI_STATUS Status;
> - CHAR16 *Temp;
> -
> - Status = EFI_SUCCESS;
> - DEBUG_CODE_BEGIN();
> -
> - if (Mapping != NULL) {
> - DEBUG((EFI_D_INFO, "Added new map item:\"%S\"\r\n", Mapping));
> - }
> - Temp = ConvertDevicePathToText(DevicePath, TRUE, TRUE);
> - DEBUG((EFI_D_INFO, "DevicePath: %S\r\n", Temp));
> - FreePool(Temp);
> -
> - DEBUG_CODE_END();
> - return (Status);
> -}
>
> /**
> This function creates a mapping for a device path.
> @@ -1333,7 +1299,7 @@ EfiShellOpenFileByName(
> // We are opening a regular file.
> //
> DevicePath = EfiShellGetDevicePathFromFilePath(FileName);
> -// DEBUG_CODE(InternalShellProtocolDebugPrintMessage (NULL, DevicePath););
> +
> if (DevicePath == NULL) {
> return (EFI_NOT_FOUND);
> }
> @@ -2261,52 +2227,7 @@ EfiShellGetGuidName(
> return (EFI_SUCCESS);
> }
>
> -/**
> - Updates a file name to be preceeded by the mapped drive name
> -
> - @param[in] BasePath the Mapped drive name to prepend
> - @param[in, out] Path pointer to pointer to the file name to update.
> -
> - @retval EFI_SUCCESS
> - @retval EFI_OUT_OF_RESOURCES
> -**/
> -EFI_STATUS
> -UpdateFileName(
> - IN CONST CHAR16 *BasePath,
> - IN OUT CHAR16 **Path
> - )
> -{
> - CHAR16 *Path2;
> - UINTN Path2Size;
> -
> - Path2Size = 0;
> - Path2 = NULL;
> -
> - ASSERT(Path != NULL);
> - ASSERT(*Path != NULL);
> - ASSERT(BasePath != NULL);
> -
> - //
> - // convert a local path to an absolute path
> - //
> - if (StrStr(*Path, L":") == NULL) {
> - ASSERT((Path2 == NULL && Path2Size == 0) || (Path2 != NULL));
> - StrnCatGrow(&Path2, &Path2Size, BasePath, 0);
> - if (Path2 == NULL) {
> - return (EFI_OUT_OF_RESOURCES);
> - }
> - ASSERT((Path2 == NULL && Path2Size == 0) || (Path2 != NULL));
> - StrnCatGrow(&Path2, &Path2Size, (*Path)[0] == L'\\'?(*Path) + 1 :*Path, 0);
> - if (Path2 == NULL) {
> - return (EFI_OUT_OF_RESOURCES);
> - }
> - }
> -
> - FreePool(*Path);
> - (*Path) = Path2;
>
> - return (EFI_SUCCESS);
> -}
>
> /**
> If FileHandle is a directory then the function reads from FileHandle and reads in
> --
> 2.18.0.windows.1
>
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] ShellPkg Shell: Remove redundant functions
2018-09-06 10:28 ` Ard Biesheuvel
@ 2018-09-06 12:24 ` Laszlo Ersek
2018-09-06 12:30 ` Ard Biesheuvel
0 siblings, 1 reply; 10+ messages in thread
From: Laszlo Ersek @ 2018-09-06 12:24 UTC (permalink / raw)
To: Ard Biesheuvel
Cc: Jim.Dailey, Carsey, Jaben, Ruiyu Ni, edk2-devel@lists.01.org
On 09/06/18 12:28, Ard Biesheuvel wrote:
> On 9 August 2018 at 17:41, <Jim.Dailey@dell.com> wrote:
>> The InvalidChars[] array is only used in function IsValidCommandName().
>> The array should be deleted also, I think.
>>
>
> Indeed, and for this reason this patch has now broken the build for
> clang. Please fix.
I agree about InvalidChars being unused, post-22cf747fcf75. I just can't
reproduce the build error, with CLANG38 (3.8.1). The command
build -a X64 -p ShellPkg/ShellPkg.dsc -b RELEASE -t CLANG38 \
-m ShellPkg/Application/Shell/Shell.inf
seems to work for me, also with "-b DEBUG".
What differs on your end?
Thanks,
Laszlo
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] ShellPkg Shell: Remove redundant functions
2018-09-06 12:24 ` Laszlo Ersek
@ 2018-09-06 12:30 ` Ard Biesheuvel
2018-09-06 15:22 ` Gao, Liming
0 siblings, 1 reply; 10+ messages in thread
From: Ard Biesheuvel @ 2018-09-06 12:30 UTC (permalink / raw)
To: Laszlo Ersek; +Cc: Jim.Dailey, Carsey, Jaben, Ruiyu Ni, edk2-devel@lists.01.org
On 6 September 2018 at 14:24, Laszlo Ersek <lersek@redhat.com> wrote:
> On 09/06/18 12:28, Ard Biesheuvel wrote:
>> On 9 August 2018 at 17:41, <Jim.Dailey@dell.com> wrote:
>>> The InvalidChars[] array is only used in function IsValidCommandName().
>>> The array should be deleted also, I think.
>>>
>>
>> Indeed, and for this reason this patch has now broken the build for
>> clang. Please fix.
>
> I agree about InvalidChars being unused, post-22cf747fcf75. I just can't
> reproduce the build error, with CLANG38 (3.8.1). The command
>
> build -a X64 -p ShellPkg/ShellPkg.dsc -b RELEASE -t CLANG38 \
> -m ShellPkg/Application/Shell/Shell.inf
>
> seems to work for me, also with "-b DEBUG".
>
> What differs on your end?
>
Not sure what the exact difference is, but I am using CLANG35 profile:
https://ci.linaro.org/job/leg-virt-tianocore-edk2-upstream/3176/consoleFull
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] ShellPkg Shell: Remove redundant functions
2018-09-06 12:30 ` Ard Biesheuvel
@ 2018-09-06 15:22 ` Gao, Liming
2018-09-06 16:18 ` Laszlo Ersek
0 siblings, 1 reply; 10+ messages in thread
From: Gao, Liming @ 2018-09-06 15:22 UTC (permalink / raw)
To: Ard Biesheuvel, Laszlo Ersek
Cc: Carsey, Jaben, Ni, Ruiyu, edk2-devel@lists.01.org
The build log shows the error message. I agree to remove this unused global variable InvalidChars in this patch.
/home/buildslave/workspace/leg-virt-tianocore-edk2-upstream/edk2/ShellPkg/Application/Shell/Shell.c:2754:21: error: unused variable 'InvalidChars' [-Werror,-Wunused-const-variable]
12:23:26 STATIC CONST UINT16 InvalidChars[] = {L'*', L'?', L'<', L'>', L'\\', L'/', L'\"', 0x0001, 0x0002};
> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Ard Biesheuvel
> Sent: Thursday, September 6, 2018 8:31 PM
> To: Laszlo Ersek <lersek@redhat.com>
> Cc: Carsey, Jaben <jaben.carsey@intel.com>; Ni, Ruiyu <ruiyu.ni@intel.com>; edk2-devel@lists.01.org
> Subject: Re: [edk2] [PATCH] ShellPkg Shell: Remove redundant functions
>
> On 6 September 2018 at 14:24, Laszlo Ersek <lersek@redhat.com> wrote:
> > On 09/06/18 12:28, Ard Biesheuvel wrote:
> >> On 9 August 2018 at 17:41, <Jim.Dailey@dell.com> wrote:
> >>> The InvalidChars[] array is only used in function IsValidCommandName().
> >>> The array should be deleted also, I think.
> >>>
> >>
> >> Indeed, and for this reason this patch has now broken the build for
> >> clang. Please fix.
> >
> > I agree about InvalidChars being unused, post-22cf747fcf75. I just can't
> > reproduce the build error, with CLANG38 (3.8.1). The command
> >
> > build -a X64 -p ShellPkg/ShellPkg.dsc -b RELEASE -t CLANG38 \
> > -m ShellPkg/Application/Shell/Shell.inf
> >
> > seems to work for me, also with "-b DEBUG".
> >
> > What differs on your end?
> >
>
> Not sure what the exact difference is, but I am using CLANG35 profile:
>
> https://ci.linaro.org/job/leg-virt-tianocore-edk2-upstream/3176/consoleFull
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] ShellPkg Shell: Remove redundant functions
2018-09-06 15:22 ` Gao, Liming
@ 2018-09-06 16:18 ` Laszlo Ersek
2018-09-07 0:57 ` Gao, Liming
0 siblings, 1 reply; 10+ messages in thread
From: Laszlo Ersek @ 2018-09-06 16:18 UTC (permalink / raw)
To: Gao, Liming, Ard Biesheuvel
Cc: Carsey, Jaben, Ni, Ruiyu, edk2-devel@lists.01.org
On 09/06/18 17:22, Gao, Liming wrote:
> The build log shows the error message. I agree to remove this unused global variable InvalidChars in this patch.
>
> /home/buildslave/workspace/leg-virt-tianocore-edk2-upstream/edk2/ShellPkg/Application/Shell/Shell.c:2754:21: error: unused variable 'InvalidChars' [-Werror,-Wunused-const-variable]
> 12:23:26 STATIC CONST UINT16 InvalidChars[] = {L'*', L'?', L'<', L'>', L'\\', L'/', L'\"', 0x0001, 0x0002};
OK... should we file a TianoCore BZ about this and wait until it gets
assigned and fixed, should we ask Shenglei just on the list to post a
follow-up (like Ard already did), or should one of us that actually
encounters the error post the one-liner patch?
(I would have already posted the patch if I could actually reproduce the
error.)
Thanks
Laszlo
>> -----Original Message-----
>> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Ard Biesheuvel
>> Sent: Thursday, September 6, 2018 8:31 PM
>> To: Laszlo Ersek <lersek@redhat.com>
>> Cc: Carsey, Jaben <jaben.carsey@intel.com>; Ni, Ruiyu <ruiyu.ni@intel.com>; edk2-devel@lists.01.org
>> Subject: Re: [edk2] [PATCH] ShellPkg Shell: Remove redundant functions
>>
>> On 6 September 2018 at 14:24, Laszlo Ersek <lersek@redhat.com> wrote:
>>> On 09/06/18 12:28, Ard Biesheuvel wrote:
>>>> On 9 August 2018 at 17:41, <Jim.Dailey@dell.com> wrote:
>>>>> The InvalidChars[] array is only used in function IsValidCommandName().
>>>>> The array should be deleted also, I think.
>>>>>
>>>>
>>>> Indeed, and for this reason this patch has now broken the build for
>>>> clang. Please fix.
>>>
>>> I agree about InvalidChars being unused, post-22cf747fcf75. I just can't
>>> reproduce the build error, with CLANG38 (3.8.1). The command
>>>
>>> build -a X64 -p ShellPkg/ShellPkg.dsc -b RELEASE -t CLANG38 \
>>> -m ShellPkg/Application/Shell/Shell.inf
>>>
>>> seems to work for me, also with "-b DEBUG".
>>>
>>> What differs on your end?
>>>
>>
>> Not sure what the exact difference is, but I am using CLANG35 profile:
>>
>> https://ci.linaro.org/job/leg-virt-tianocore-edk2-upstream/3176/consoleFull
>> _______________________________________________
>> edk2-devel mailing list
>> edk2-devel@lists.01.org
>> https://lists.01.org/mailman/listinfo/edk2-devel
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] ShellPkg Shell: Remove redundant functions
2018-09-06 16:18 ` Laszlo Ersek
@ 2018-09-07 0:57 ` Gao, Liming
0 siblings, 0 replies; 10+ messages in thread
From: Gao, Liming @ 2018-09-07 0:57 UTC (permalink / raw)
To: Laszlo Ersek, Ard Biesheuvel
Cc: Carsey, Jaben, Ni, Ruiyu, edk2-devel@lists.01.org, Gao, Liming,
Zhang, Shenglei
Laszlo:
I ask Shenglei to provide the patch to fix this failure. Today, I meet with the failure in XCODE5 tool chain.
Thanks
Liming
> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Laszlo Ersek
> Sent: Friday, September 7, 2018 12:19 AM
> To: Gao, Liming <liming.gao@intel.com>; Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Cc: Carsey, Jaben <jaben.carsey@intel.com>; Ni, Ruiyu <ruiyu.ni@intel.com>; edk2-devel@lists.01.org
> Subject: Re: [edk2] [PATCH] ShellPkg Shell: Remove redundant functions
>
> On 09/06/18 17:22, Gao, Liming wrote:
> > The build log shows the error message. I agree to remove this unused global variable InvalidChars in this patch.
> >
> > /home/buildslave/workspace/leg-virt-tianocore-edk2-upstream/edk2/ShellPkg/Application/Shell/Shell.c:2754:21: error: unused
> variable 'InvalidChars' [-Werror,-Wunused-const-variable]
> > 12:23:26 STATIC CONST UINT16 InvalidChars[] = {L'*', L'?', L'<', L'>', L'\\', L'/', L'\"', 0x0001, 0x0002};
>
> OK... should we file a TianoCore BZ about this and wait until it gets
> assigned and fixed, should we ask Shenglei just on the list to post a
> follow-up (like Ard already did), or should one of us that actually
> encounters the error post the one-liner patch?
>
> (I would have already posted the patch if I could actually reproduce the
> error.)
>
> Thanks
> Laszlo
>
> >> -----Original Message-----
> >> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Ard Biesheuvel
> >> Sent: Thursday, September 6, 2018 8:31 PM
> >> To: Laszlo Ersek <lersek@redhat.com>
> >> Cc: Carsey, Jaben <jaben.carsey@intel.com>; Ni, Ruiyu <ruiyu.ni@intel.com>; edk2-devel@lists.01.org
> >> Subject: Re: [edk2] [PATCH] ShellPkg Shell: Remove redundant functions
> >>
> >> On 6 September 2018 at 14:24, Laszlo Ersek <lersek@redhat.com> wrote:
> >>> On 09/06/18 12:28, Ard Biesheuvel wrote:
> >>>> On 9 August 2018 at 17:41, <Jim.Dailey@dell.com> wrote:
> >>>>> The InvalidChars[] array is only used in function IsValidCommandName().
> >>>>> The array should be deleted also, I think.
> >>>>>
> >>>>
> >>>> Indeed, and for this reason this patch has now broken the build for
> >>>> clang. Please fix.
> >>>
> >>> I agree about InvalidChars being unused, post-22cf747fcf75. I just can't
> >>> reproduce the build error, with CLANG38 (3.8.1). The command
> >>>
> >>> build -a X64 -p ShellPkg/ShellPkg.dsc -b RELEASE -t CLANG38 \
> >>> -m ShellPkg/Application/Shell/Shell.inf
> >>>
> >>> seems to work for me, also with "-b DEBUG".
> >>>
> >>> What differs on your end?
> >>>
> >>
> >> Not sure what the exact difference is, but I am using CLANG35 profile:
> >>
> >> https://ci.linaro.org/job/leg-virt-tianocore-edk2-upstream/3176/consoleFull
> >> _______________________________________________
> >> edk2-devel mailing list
> >> edk2-devel@lists.01.org
> >> https://lists.01.org/mailman/listinfo/edk2-devel
>
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2018-09-07 0:57 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-09 5:41 [PATCH] ShellPkg Shell: Remove redundant functions shenglei
2018-08-09 15:34 ` Carsey, Jaben
2018-08-09 15:41 ` Jim.Dailey
2018-08-09 16:17 ` Laszlo Ersek
2018-09-06 10:28 ` Ard Biesheuvel
2018-09-06 12:24 ` Laszlo Ersek
2018-09-06 12:30 ` Ard Biesheuvel
2018-09-06 15:22 ` Gao, Liming
2018-09-06 16:18 ` Laszlo Ersek
2018-09-07 0:57 ` Gao, Liming
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox